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
  • 相关阅读:
    hdfs搭建常见问题
    [转]opencv与Labview的结合(Dll调用)
    [转]opencv二值化的cv2.threshold函数
    忙在比赛前
    [转]使用charls抓包微信小程序的解决方案
    [转]Python调用C语言
    [转]基于Python实现matplotlib中动态更新图片(交互式绘图)
    [转]Python十六进制与字符串的转换
    STM32学习日记
    [转]Linux下的softlink和hardlink
  • 原文地址:https://www.cnblogs.com/syf/p/2709331.html
Copyright © 2011-2022 走看看