How can I make a program wait for a variable change in javascript?

前端 未结 10 1793
耶瑟儿~
耶瑟儿~ 2020-12-01 03:23

I want to force a JavaScript program to wait in some particular points of its execution until a variable has changed. Is there a way to do it? I have already found an extens

10条回答
  •  误落风尘
    2020-12-01 04:12

    JavaScript is one of the worst program\scripting language ever!

    "Wait" seems to be impossible in JavaScript! (Yes, like in the real life, sometimes waiting is the best option!)

    I tried "while" loop and "Recursion" (a function calls itself repeatedly until ...), but JavaScript refuses to work anyway! (This is unbelievable, but anyway, see the codes below:)

    while loop:

    
    
    
    

    Recursion:

    
    
    1234
    
    
    

提交回复
热议问题