search

Home  >  Q&A  >  body text

Can two functions in a js file call each other?

请问一下各位前辈,我在一个js文件中写了两个函数,
单独使用时两个都能正常工作,但我在一个中调用另一个时,
被调用的函数却不能工作,这是什么原因?代码大意如下:
function aa()
{
一些代码;
bb();
}

function bb()

{

Some code;

}

享耳享耳2033 days ago1339

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2019-05-05 09:07:08

    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
    1
  • 享耳

    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

    享耳 · 2019-05-05 20:31:44
  • Cancelreply