是否有可能在同一个函数内部调用一个函数 [英] is it possible to call a funcion inside the same funcion itself

查看:72
本文介绍了是否有可能在同一个函数内部调用一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好可以使用javascript在同一个函数内部调用一个函数,例如



funcion sample(){

一些代码......

...

...

样本();



}

解决方案

请参阅此处的参考资料..



http://stackoverflow.com/questions/3145905/function-calling-itself-not-working -infinite-loop-javascript [ ^ ]

http://stackoverflow.com/questions/7369681/calling-a-function-inside-itself-using-settimeout [ ^ ]

http://stackoverflow.com/questions/16841322/javascript-objects-calling-function-from-itself [ ^ ]






是的,它是可能的,它被称为递归函数。



看看< a href =https://msdn.microsoft.com/en-us/library/ie/wwbyhkx4%28v=vs.94%29.aspx>这里或在其中作为示例和解释。



...希望它有所帮助。

Hello is it possible to call a funcion inside the same funcion itself using javascript like

funcion sample(){
some code......
...
...
sample();

}

解决方案

See Ref here..

http://stackoverflow.com/questions/3145905/function-calling-itself-not-working-infinite-loop-javascript[^]
http://stackoverflow.com/questions/7369681/calling-a-function-inside-itself-using-settimeout[^]
http://stackoverflow.com/questions/16841322/javascript-objects-calling-function-from-itself[^]


Hi,

Yes it is possible, it's know as a recursive function.

Have a look here or here for an example and explanation.

... hope it helps.


这篇关于是否有可能在同一个函数内部调用一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆