var multiply = new Function('x', 'y', 'return x * y;');
function multiply(x, y) {
return x * y;
}
var multiply = function(x, y) {
return x * y;
}
var multiply = function multi(x, y) {
return x * y;
}
multiply = function(x, y) {
return x + y;
}
var foo = function bar() {
alert('hello');
}
foo(); // 提示“hello”字符串
bar(); // 执行报错,bar未定义
function foo() {}
alert(foo); // 提示包含“foo”的函数名
var bar = foo;
alert(bar); // 提示依然只包含“foo”的函数名,和bar半毛钱关系都没有
foo(); // 提示Foo
function foo() {
alert('Foo');
}
bar(); // 哥们,和上面确实不一样,就不要逞能,这不报错了?提示bar未定义
var bar = function() {
alert('Bar');
}
function foo() {
var hi = 'hello';
//return function() {
// alert(hi);
//};
return Function('return hi;');
}
foo()(); // 执行效果大家自己跑一下看看
var x = 0; // source element
if (x == 0) { // source element
x = 10; // not a source element, 因为嵌套在了if语句里
function boo() {} // not a source element, 因为嵌套在了if语句里
}
function foo() { // source element
var y = 20; // source element
function bar() {} // source element
while (y == 10) { // source element
function blah() {} // not a source element, 因为嵌套在了while语句里
y++; // not a source element, 因为嵌套在了while语句里
}
}
// 函数声明
function foo() {}
// 函数表达式
(function bar() {})
// 函数表达式
x = function hello() {}
if (x) {
// 函数表达式
function world() {}
}
// function statement
function a() {
// function statement
function b() {}
if (0) {
// 函数表达式
function c() {}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有