1. 在document.writeln() ;语句中使用转义字符时,只有将之放在格式化文本模块中才会起作用:
document.writeln(“<pre>”);
document.writeln(“hahahahh\nhehehehhe”);
document.writeln(“</pre>”);
Output: hahahahah
hehehheheh
2. window.alert(“…………”); 弹出警告框
3.<noscript> 不支持js的浏览器中将被显示 </noscript>
4. 数字不能打头,是为了js能轻易分别出数字和标识符
5. null表示一个变量被赋予了空值,而undefined是表示该变量还没有被赋值; null也不能等同于空字符串 “”
6. ==:等于,只根据表面值进行判断,不涉及类型
如:“27”= = 27 , 结果是true
= = = :绝对等于,同时判断表面值和数据类型,
如:“27”= = = 27 , 结果是false
7. != :不判断类型; != = :判断类型
8. event.altKey , 如果alt键被按下则此值为 true
Window.event.keyCode= = 37 : 方向键 左键
Window.event.keyCode= = 39 : 右键
9. typeof : 返回操作数的类型:
如: typeof true ;
共6种返回情况:number , boolean, string , object, function , undefined
10. string.toLowerCase(); 转成小写
转载于:https://blog.51cto.com/linkindick/506578