首页 > 代码库 > javascript function
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"
javascript function
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。