zoukankan      html  css  js  c++  java
  • javascript function

    function assert(value1, value2) {
      if (value1) {
        console.log(value2);
      }
    }
    
    function isNimble() {
      return true;
    }
    assert(typeof window.isNimble === "function", "is isNimbl() defined");
    assert(isNimble.name === "isNimble", "isNimble() has a name");
    
    var canFly = function() {
      return true;
    };
    assert(typeof window.canFly === "function", "canFly() defined");
    assert(canFly.name === "", "canFly() has no name");
    
    window.isDeadly = function() {
      return true;
    };
    assert(typeof window.isDeadly === "function", "isDeadly() defined");
    assert(isDeadly.name === "isDeadly", "isDeadly() has a name");
    
    function outer() {
      assert(typeof inner === "function", "inner() in scope before declaration");
      function inner () {}
      assert(typeof inner === "function", "inner() in scope after declaration");
      assert(window.inner === undefined, "inner() not in global scope");
    }
    
    outer();
    assert(window.inner === undefined, "inner() stilll not in global scope");
    
    
    window.wieldsSword = function swingsSword() { return true; };
    assert(window.wieldsSword.name === 'swingsSword', "wieldSword's real name is swingsSword");
    "is isNimbl() defined"
    "isNimble() has a name"
    "canFly() defined"
    "canFly() has no name"
    "isDeadly() defined"
    "inner() in scope before declaration"
    "inner() in scope after declaration"
    "inner() not in global scope"
    "inner() stilll not in global scope"
    "wieldSword's real name is swingsSword"
  • 相关阅读:
    ajaxFileUpload 实现多文件上传(源码)
    Springboot 热部署的两种方式
    基于树莓派3B+Python3.5的OpenCV3.4的配置教程
    Shiro 架构原理
    Cron表达式
    SpringBoot中Scheduled代码实现
    Linus安装mysql8
    查看虚拟机CENTOS7 的 IP 地址和命令
    linux vi保存退出命令 (如何退出vi)
    Linux常用命令大全
  • 原文地址:https://www.cnblogs.com/Iwillknow/p/4030957.html
Copyright © 2011-2022 走看看