title: Some tips about learning JavaScript layout: post thread: 161 date: 2015-08-28 author: Joe Jiang categories: Document tags: [JavaScript]
Boolean()
//将一个值转换为其对应的Boolean值;Number.MIN_VALUE / Number.MAX_VALUE
//分别代表ECMAScript中能表示的数值最小值和最大值;isFinite()
//查看数值是否无穷,返回true或者false;isNaN()
//查看结果是否不是数值;Number()
、parseInt()
和parseFloat()
,第一个函数,即转型函数Number()可以用于任何数据类型,而另两个函数则专门用于把字符串转换成数值;Attention: parseInt 允许我们自定义接受参数的进制格式.比如以0开头的字符串很少会被用于八进制格式化(特别是在用户输入中). 为了处理这类问题, parseInt 接受第二个参数,基数.它可以指出第一个字符串参数要被如何解析.特别指出,第二个参数如果是 10 , parseInt 函数将解析第一参数字符串只能为十进制,例如parseInt(col, 10)
valueOf()
// 返回对象的初始值;result = variable instanceof constructor
// 查看variable是否为constructor类型;hasOwnProperty
是 JavaScript 中唯一一个处理属性但是不查找原型链的函数。The most important four elements in understanding JavaScript are:
There's really a lot of resource when you Google how to understand them, so I do not repeat them here. Then follows two links about how to learn them well in a better way, the first website is JavaScript: The Right Way. The content covers a guide intended to introduce new developers to JavaScript and help experienced developers learn more about its best practices, such as JavaScript Code Style, design patterns contained in JavaScript, some frameworks, game engines, etc. The website may not explain the points that mentioned in it specifically, but it really gives people a good direction in how to understand and learn JavaScript deeply.
The second link I want to share is Principles of Writing Consistent, Idiomatic JavaScript. It is a document about how to write consistent, idiomatic JavaScript in our daily life. It provides many translated versions for different kinds of people around the world.