zoukankan      html  css  js  c++  java
  • JavaScript很有意思的"alert"例子

     1 alert("-------------0--------------");
     2 alert(Object.prototype); 
     3 alert("-------------1--------------");
     4 Function.prototype.age="4444";
     5 function x(){};
     6 alert(x.age); //print 4444
     7 alert("-------------2--------------");
     8 Object.prototype.name="5555";
     9 var x=new Object();
    10 alert(x.name); //print 55555
    11 alert("-------------3--------------");
    12 Object.prototype.sex="6666";
    13 function x(){}
    14 alert(x.sex); //print 6666
    15 alert("-------------4--------------");
    16 Function.prototype.score="7777";
    17 var x=new Object();
    18 alert(x.score); //print undefined
    19 
    20 
    21 alert(String.constructor);
    22 var x=new String();
    23 alert(typeof x);
    24 var y=new Function();
    25 y();
    26 alert(typeof y);
    27 
    28 
    29 
    30 //alert(test.prototype);
    31 //alert(Object.prototype);
    32 //alert(Function.prototype);
    33 //alert(test.__proto__);
    34 //alert(Object.__proto__);
    35 //alert(Function.__proto__);
    36 //alert(Object.prototype.__proto__);
    37 //alert(Object.prototype.constructor);
    38 alert(Function.prototype.__proto__);
    39 alert(Function.prototype.__proto__.__proto__);
    40 alert(Function.__proto__===Object.__proto__);
    41 
    42 
    43 
    44 alert(Function instanceof Function);//true  
    45 alert(Function instanceof Object);//true     
    46 alert(Object instanceof Function);//true  
    47           
    48 function Foo() {}; 
    49 var foo = new Foo(); 
    50 alert(foo instanceof Foo); // true 
    51 alert(foo instanceof Function); // false 
    52 alert(foo instanceof Object); // true 
    53 alert(Foo instanceof Function); // true 
    54 alert(Foo instanceof Object); // true
  • 相关阅读:
    Linux 共享库
    使用Visual Studio(VS)开发Qt程序代码提示功能的实现(转)
    ZOJ 3469 Food Delivery(区间DP)
    POJ 2955 Brackets (区间DP)
    HDU 3555 Bomb(数位DP)
    HDU 2089 不要62(数位DP)
    UESTC 1307 windy数(数位DP)
    HDU 4352 XHXJ's LIS(数位DP)
    POJ 3252 Round Numbers(数位DP)
    HDU 2476 String painter (区间DP)
  • 原文地址:https://www.cnblogs.com/syf/p/2709331.html
Copyright © 2011-2022 走看看