JavaScript: Understanding ES6 and Beyond
- lexical environment, curly brace
- var, global
- let, in the same block or block going up
- const, similar to let, but the binding is immutable
- concatenation
- string + string
- interpolation
- replace portions of strings with other strings. It described as inserting or injecting strings into another strings
- dollar sign and curing brace within string
-
let firstname = Steven; let lastname = Jie; let fullname = `${firstname} ${lastname}`
- a structure in a programming language that provides a way to create objects
- class, function object
- instance, the actual object created from an object creation feature(like a class)
- how to understand
__proto__
and prototype?- JavaScript has a built-in constructor called Object(), and the prototype property of this function points to an empty object
- thus, we can say
it is true
( new Foo ).__proto__.__proto__ === Object.prototype
- and
it is true
( new Foo ).__proto__.__proto__.__proto__ === null
- if there is inheritence in it, it would be more fun, assume that Staff extends to Person,
thus,
let a = new Person('Rick') let b = new Staff('Steve')
there are all true!b.__proto__ === Staff.prototype Staff.prototype.__proto__ === Person.prototype b.__proto__.__proto__ === Person.prototype Person.prototype.__proto__ === Object.prototype b.__proto__.__proto__.__proto__ === Object.prototype Object.prototype.__proto__ === null b.__proto__.__proto__.__proto__.__proto__ === null
- more details, refer to this link
- static
- create a method or variable that it doesn't reference any of the fields in the class
- private fields
- use
#
- getter, setter
- use
- private methods
- if parameters are undefined, then the default value will be instead of it
- if parameters are null, then the default value will not work