nan是非数字类型,返回的是一个数值的类型
alert(typeof (NaN)) ——> number
alert(typeof 2) ——>number
alert(typeof {})——> object
alert(typeof [])——> object
alert(typeof null) ——> object
alert (typeof undefined) —> undefined
alert (typeof object) ——>function
优先级:
变量 > 函数> 参数 > 提升
Array.prototype= __proto__
输出下列结果:
console.log( true + 1 ); //结果为2
console.log( name + true ); //结果为nametrue
console.log( undefined + 1 ); //结果为NaN
console.log( typeof null ); //结果为object
在javascript中两个变量相除得到一个百分比保留两位小数
Math.round(num1 / num2 * 10000) / 100 + “%”;