Jac*_*Guy 3 javascript console execution
我的代码看起来像这样:
function pathfind (start,end,map)
{
this.Init = function ()
{
this.open_node = new Array();
this.open_node.push(start);
console.log(this.open_node);
this.Loop();
}
this.Loop = function ()
{
//Some code here
}
this.Init();
}
Run Code Online (Sandbox Code Playgroud)
出于某种原因,当我将"start"推入this.open_node并记录其值时,我得到"未定义".但是,经过一些错误测试,我意识到这个评论出来了.Loop(); 在this.Init中导致push正常运行,console.log按原样返回[start].任何人都可以解释为什么会发生这种行为?
编辑:我在打电话
pathfind({x:2,y:2},{x:24,y:24},parsemap(25,25));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1430 次 |
| 最近记录: |