This is possible if the variable a is accessed by, say, 2 web workers via SharedArrayBuffer, as well as some basic scripts. The possibility is low, but it is possible that when the code is compiled into machine code, the working networks update the variable a just in time, therefore the conditions a==1 , a==2 and a==3 are fulfilled.
This might be an example of race conditions in a multi-threaded environment provided by web workers and SharedArrayBuffer in JavaScript.
Here is the basic implementation above:
main.js
// Main Thread const worker = new Worker('worker.js') const modifiers = [new Worker('modifier.js'), new Worker('modifier.js')] // Let use 2 workers const sab = new SharedArrayBuffer(1) modifiers.forEach(m => m.postMessage(sab)) worker.postMessage(sab)
worker.js
let array Object.defineProperty(self, 'a', { get() { return array[0] } }); addEventListener('message', ({data}) => { array = new Uint8Array(data) let count = 0 do { var res = a == 1 && a == 2 && a == 3 ++count } while(res == false)
modifier.js
addEventListener('message' , ({data}) => { setInterval( () => { new Uint8Array(data)[0] = Math.floor(Math.random()*3) + 1 }) })
On my MacBook Air, this happens after about 10 billion iterations on the first try:

Second attempt:

As I said, the chances will be low, but given enough time, he will fall into a state.
Tip. If your system has too much time. Try only a == 1 && a == 2 and change Math.random()*3 to Math.random()*2 . Adding more and more to the list reduces the chance of a hit.
source share