Penguin said:
Hi All,
I would like to use thread in javascript how to do that?
Execute some code - there is only one thread, so whatever runs uses it.
like in java to implement Runable or extends Thread class.
Only one thread, no classes. You can use setTimeout or setInterval to
make things happen other than synchronously, but never in another
thread.
I guess some implementations of JavaScript could be multi-threaded, but
there is nothing in the ECMAScript specification to let you manage
them. So if some UA somewhere does have a multi-threaded script
environment, from a programmers' viewpoint, it's single threaded unless
it also has non-standard extensions to manage them.
could you show a snippet of code?
function funcA() { /* ...do lots of stuff...*/ }
function funcB() { /* ...do very little stuff...*/ }
funcA();
funcB();
funcA will always finish before funcB is called.
