35

45个有用的JavaScript技巧,窍门和最佳实践

 4 years ago
source link: https://juejin.im/post/5cd24b59e51d453a8f348bca
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
1. 首次为变量赋值时务必使用var关键字 变量没有声明而直接赋值得话,默认会作为一个新的全局变量,要尽量避免使用全局变量。 2. 使用===取代== ==和!=操作符会在需要的情况下自动转换数据类型。但===和!==不会,它们会同时比较值和数据类型,这也使得

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK