ES6 Flashcards

1
Q

What is syntactic sugar?

A

syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express

syntactic sugar is syntax designed to make things easier to read / express

syntax to make things easier to read / express

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is the typeof an es6 class

what is the return of typeof an es6 class*

A

the typeof an es6 class = function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

describe es6 class syntax

A

use the class keyword to create a class:

class ClassName { code block}

class name will be capitalized

always add a method named constructor()

class ClassName {
constructor(value1, value2)
}

the constructor() method is where you will create the object’s properties and use the arguments passed in as values for said property

constructor(value1,value2) {
this.property1 = value1;
this.propert2 = value2;
}

the constructor() method is automatically called if you create a new object

class ClassName {
  constructor() { ... }
}
class Car {
  constructor(name, year) {
    this.name = name;
    this.year = year;
  }
}
let car1 = new Car("Ford", 2014);
let car2 = new Car("Mazda", 1994);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is refactoring?

A

in computer programming, code refactoring is the process of restructuring existing computer code - changing the factoring - without changing its external behavior

code refactoring = restructuring existing code, changing the factoring without its external behavior

changing code while keeping the same function

ex: converting function to arrow function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a JavaScript class?

A

JavaScript class:

blueprint for creating objects

just special functions

templates for objects

it is NOT an object

it is a template for objects

used to create objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what does an object constructor function do?

A

sometimes we need a template for creating many objects of the same “type”

to create an object type / template, we use an object constructor function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is the constructor() method?

A

constructor() method:

special method of keyword class

automatically executed when a new object is created

creates and initializes an object instance of that class/type

used to initialize object properties PROPERTIES

it does not include the object’s methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does instantiated mean?

A

instantiation:

in programming, instantiation is the creation of a real instance or particular realization of an abstraction or template such as a class of objects

to create

in es6 context

const object = new ClassName(arg)

we just instantiated or created an object with whatever properties are within the constructor() method of the class ClassName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does instantiated mean?

A

instantiation:

in programming, instantiation is the creation of a real instance or particular realization of an abstraction or template such as a class of objects

to create

How well did you know this?
1
Not at all
2
3
4
5
Perfectly