+ 2
JS Main Method? (ProcessingJS)
Does javascript have a main method similar to Java main(string[] args) How do we interact live with our html website. Using setInterval for the method (although it can work as a loop) seems far fetched and absurd. What is the better way. KhanAcademy used something called ProcessingJS which updated on the fly. How does that not work here too?
6 Respuestas
+ 1
It run once when the page loaded.
JavaScript would also run if there is event listening triggered or timer codes.
+ 3
nope JavaScript has no main method,doesnt need one..
and i dont think processingJs is a standard part of js
+ 1
If you need to run a function after a page loaded, it could be triggered by an event or set timer to run it.
You could also create worker thread to run JavaScript, but it's not common on front end page.
0
JavaScript does not need a startup function like Java, it runs directly inside <script></script> in a html file.
0
Then how does it run infinitely, just like a main method would?
0
So basically, if I want it to run more than once, I need to make an artificial run method and call it as a setInterval for something like every .01 seconds or so?