标签:href 自己 函数调用 返回值 取值 例子 define turn for语句
1. 脚本函数的执行时在栈上执行的,在函数调用其他的函数的时候,需要保存当前函数执行的上下文,把执行的上下文加入栈中,当函数执行完成后从栈中取出上下文接着执行。
//下面例子中 bb中number1取得值是调用bb函数传入的值,是就近获取的,先从离自己最近的作用域中获取值 function aa(number1,number2){function bb(number1){return number1*number2; }var num= bb(3); console.log(num); } aa(1,2); // 6 p1=0;function cc(){var p1=1; console.log(p1);} cc(); // 1 console.log(p1); // 0标签:href 自己 函数调用 返回值 取值 例子 define turn for语句
原文地址:http://www.cnblogs.com/xinxinzhihuo/p/6050588.html