3 回答
TA贡献1835条经验 获得超7个赞
根据您对Camsoft的评论进行更新
thisfor (var propName in ____)thisarguments
var n, arg, name;alert("typeof this = " + typeof this);for (name in this) {
alert("this[" + name + "]=" + this[name]);}for (n = 0; n < arguments.length; ++n) {
arg = arguments[n];
alert("typeof arguments[" + n + "] = " + typeof arg);
for (name in arg) {
alert("arguments[" + n + "][" + name + "]=" + arg[name]);
}}TA贡献1780条经验 获得超1个赞
var f = function() {
var x = 0;
console.log(x);};var s = f + '';
'function () {\nvar x = 0;\nconsole.log(x);\n}'var s = 'function () {\nvar x = 0;\nconsole.log(x);\n}';s = s.slice(12);
// to remove "function () "var esprima = require('esprima');var result = esprima.parse(s);obj.type == "VariableDeclaration"
console.log(x)
{
"type": "Program",
"body": [
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "x"
},
"init": {
"type": "Literal",
"value": 0,
"raw": "0"
}
}
],
"kind": "var"
}
]}var g = function() {
var y = 0;
var f = function() {
var x = 0;
console.log(x);
};}添加回答
举报
