js小测试

1:    1 && 3
2:    1 && "foo" || 0
 
3:    1 || "foo" && 0
4:    (1,2,3)
5:     x = {shift:[].shift};
        x.shift();
        x.length;
6:    {foo:1}[0]
  eval('{foo:1}[0]')
7:    [true, false][+true, +false]
8:    ++'52'.split('')[0]
9:    a: b: c: d: e: f: g: 1, 2, 3, 4, 5;
10:    {a: 1, b: 2}[["b"]]
11:    "b" + 45
12:    {a:{b:2}}
 
13:    (function(){}())
14:    [1,2,3,4,5][0..toString.length]
15:    ({} + 'b' > {} + 'a')
16:    Number.prototype.x = function(){ return this === 123; };
        (123).x();
17:    Array(2).join()    Array([2]).join()
18:    vars: var vars = vars;
19:    { foo = 123 }
20:    x = 1; (function(){return x; var x = 2;}())
21:    delete [].length;
 
22:    RegExp.prototype.toString = function() {return this.source};
        /3/-/2/;
23:    {break;4;}
24:    'foo' == new function(){ return String('foo'); };
   'foo' == new function(){ return new String('foo');
   'foo' == new  String('foo');
   'foo' == String('foo');
 
25:    'foo'.split('') + []
   'foo'.split('') + [1,2]
 
 
JS基本类型:
1、typeof(NaN) 、typeof(Infinity)、typeof(null)、typeof(undefined)
2、NaN == NaN  
3、NaN != NaN
4、NaN >= NaN  
5、null == undefined 
6、null >= undefined  
7、null <= undefined
8、parseInt("123abc")
9、"123abc" - 0  
10、Infinity > 10  
11、Infinity > "abc"  
12、Infinity == NaN     
  Infinity == Infinity 
13、true == 1 
14、new String("abc") == "abc"
15、new String("abc") === "abc"
  null  instanceof  Object
  typeof(function(){})  
 
 
 
 
第二个是月影的博客,我补充了几个
有兴趣可以试试~
posted @ 2013-09-05 19:58  sunnyfish  阅读(277)  评论(0)    收藏  举报