命名和匿名函数的行为

时间:2014-03-04 13:33:58

标签: javascript

检查以下情况: -

function x() {
    console.log('x');
};
x(); //outputs x

var y = function () {
    console.log('y');
};
y(); //outputs y

var z = function w() {
    console.log('zw')
};
z(); //outputs zw;
w(); //outputs .. w is not defined.

任何人都能解释一下这种行为吗??

0 个答案:

没有答案