-4

I have two function and I need to execute it at same time using javacript or any parallel function. How can i do?

Thank so.

Jason Spradlin
  • 1,407
  • 9
  • 14

2 Answers2

1

I'm not sure you'll find exactly what you're looking for. Does it have to be exactly at the same time? Javascript is single-threaded. But you could do async calls. Would that meet your use case? If not, you could check out Web Workers, but I've never used that before.

Can javascript run multiple functions at once?

Simultaneous code in javascript?

Dallas
  • 179
  • 1
  • 12
0

JavaScript is fundamentally not multithreaded. It just processes events in a single pipeline.

There is an npm package that can do multithreading if that's what you really need here:

https://www.npmjs.com/package/threads

NeRa
  • 101
  • 5