zoukankan      html  css  js  c++  java
  • JavaScript杂谈(第六天)

    js中可以使用Function创建函数

    var func=new Function();

    这个对象可以将字符串转换为函数

    var func=new Function("console.write('hello world')");

    func();

    函数中有内置的arguments变量,根据这个变量可以获取到函数传递过来的所有参数;这就使我们可以使用可变参数列表的函数;

    function test(){

      for(var i=0;i<arguments.length;i++){

        console.write(argument[i]);

      }

    }

    test(1,2,3,4);

    instanceof 关键字的使用方法;判断构造函数是否存在于对象的原型链上;

    function Person(){};

    var p=new Person();

    console.write(p instanceof Person);//true;

    console.write(p instanceof Object);//true;

  • 相关阅读:
    从头学Android之Android布局管理:LinerLayout线性布局
    Android onTouch事件传递机制
    android开源项目和框架
    <hdu
    <hdu
    <poj
    <poj
    <hdu
    <hdu
    <hdu
  • 原文地址:https://www.cnblogs.com/ljs0322/p/8995881.html
Copyright © 2011-2022 走看看