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
  • 相关阅读:
    Dependency Injection in ASP.NET Web API 2
    js, lambada? 在chrome和node下可以使用
    jquery text
    bugs view:
    支持 gRPC 长链接,深度解读 Nacos 2.0 架构设计及新模型
    阿里云 ecs云主机 静默安装oracle11g
    mysql1033错误 InnoDB临时表空间报错
    8888. Distance Between 2 Nodes in BST
    783. Minimum Distance Between BST Nodes
    530. Minimum Absolute Difference in BST
  • 原文地址:https://www.cnblogs.com/syf/p/2709331.html
Copyright © 2011-2022 走看看