ES6 Refresher

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Array.map

Can create a new array with manipulated elements using this. let newArray = myArray.map(elem => elem + 1);

const

Constants Only accessible in block variable is defined in Variable marked as read-only.

What is a module?

JavaScript where you export a function or class to be used somewhere else

this

Keyword in javascript Determined by how function is called. If called as method of function, returns that object. Otherwise returns window object (or undefined if in strict mode)

let vs var

Only accessible in block variable is called in. Var is accessible in entire function it is declared in

Combine first and second array with spread operator const first = [1,2]; const second = [3,4];

const combined = [...first, ...second];

Export and import and class JavaScript

export class myClass {...} import {myClass} from './myLocation.js'

Destructure this object into new variables s1 and n1. Don't get the age let person= {street: "Page rd", age: 3, name: "Jim"}

let {street: s1, name: n1} = person;

let person = { walk: function(){}, talk(){} } Are these both valid ways of declaring a method in a JavaScript object?

Yes

Have a teacher class get all properties and methods of person class

class Teacher extends Person{ }

T/F spread operator works with objects

T const first = {name:'llama'}; const second = {age:3}; const combined = {...first, ...second, color:'red'}

Arrow functions and this keyword

The this keyword is not re-interpreted by arrow functions. This is important for functions like setTimeout where the context of this would change


Set pelajaran terkait

CEH Module 17: Hacking Mobile Platform

View Set

Chapter 06 Manufacturing and Service Processes

View Set

Belanger Ch 10 - Networks and Telecommunications

View Set

Section 27: Math Basics for Delaware

View Set