DOM API
async/defer
interpreted, just-in-time compiling
dynamic, loosely typed
scripts can be put internal, external, inline (bad).
In fact, there is no “constructor” function, there is only “constructive call”.
Inheritance is essentially copying.
In javascript, there are mainly 7 types:
- number
- boolean
- string
- null
- undefined
- symbol
- object
copy value vs. copy reference:
For object
(including function
, array
), assignments pass reference; for others (scalar types), assignments pass values.
variable vs. value
javacript中变量没有类型,只有值才有类型。
给变量赋值只会改变该变量的指向,不会改变原指向的值。
undefined vs. undeclared (Reference Error) typeof <undeclared>
有安全保护
if (typeof DEBUG != 'undefined'){
//...
}
string
type is inmutable.undefined
指从未赋值null
指曾赋过值,但是当前值为空 null
是关键字,不能作为identifier, 而undefined
可以NaN
是number
类型, 唯一非自反的值 (NaN !=NaN
)