2014年3月17日

知识点

摘要: 1. new Date.getYear();返回值:(默认为当前系统时间)114;返回当前年份减去1900,不同浏览器处理结果不同firefox chrome:返回当前年代减去1900IE和opear如果年份为1900-1999,返回时间减去1900,如:1980年得到getYear时间是80,不在此年份的时间,返回四位数,规避:用new Date.getFullYear()取代;2. epxpires 格式是GMT格式;toGMTString()或toUTCString(),现在推荐使用toUTCString()方法。3.当需要判断一个变量是否为 undefined 时,直接用Js代码 a. 阅读全文

posted @ 2014-03-17 16:17 icelin 阅读(254) 评论(0) 推荐(0)

一道变态的Javascript面试题

摘要: 转载http://cymoft.blog.51cto.com/324099/1260099123456789f =function() {returntrue;};g =function() {returnfalse;};(function() {if(g() && [] == ![]) {f =functionf() {returnfalse;};functiong() {returntrue;}}})();alert(f());// true or false ?此题的关键是第4行的if条件g() && [] == ![]这里有三个关键的点,第一,g()在这 阅读全文

posted @ 2014-03-17 15:54 icelin 阅读(465) 评论(1) 推荐(0)

导航