jsuwp-7-65 ~ 7-68 Odds and Ends
7-65 Initialization
- use literal notaion to initialization
- convenient for testing
- js engine will check syntax for you
1 |
|
7-66 typeof instanceof
typeof : return the type name in String
some unexpected result : [], undefined, null
instanceof : find in deeper prototype chain, check if the type in the chain
1 |
|
7-67 Strict Mode
- optional
- must be in the top of file or top of the function
- not every js engine implement strict mode in the same way
- 可能問題
當多個js files合併時(produciton常用),最開始的js file若使用了strict mode,則後面的files都會受到影響
不能保證其它lib都遵守strict mode
1 | //'use strict'; |