First look up the definition of a lock and mutual exclusion. There are two types of basic locks: mutexes and semaphores. Both keep two threads or coroutines from executing a block of code/instructions at the same time, and both work in a similar way I already described.
> There simply is no concurrency in JS though,
There is no parallelism in JS (well there is with workers now), concurrency is not parallelism.