Can two functions in a js file call each other?
享耳
享耳 2019-05-04 21:38:14
0
2
1354
请问一下各位前辈,我在一个js文件中写了两个函数,
单独使用时两个都能正常工作,但我在一个中调用另一个时,
被调用的函数却不能工作,这是什么原因?代码大意如下:
function aa()
{
一些代码;
bb();
}

function bb()

{

Some code;

}

享耳
享耳

reply all(1)
ringa_lee

There is no problem with the call. It can be called normally. As for whether it is not running because your previous code has stopped, you can send the complete code so that we can use it as a reference.

  • reply Thank you for your answer. I found the problem. It turns out that there is a problem with the for loop in the js function. It needs to be looped 3 times, for (var i=0;i<x;i++). I wrote it 4 times, for (var i=0 ;i<=x;i++), the system will not report an error for this problem, and you need to test it sentence by sentence to find it.
    享耳 author 2019-05-05 20:31:44
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template