how to check if function is running js

JavaScript
var functionIsRunning = false;

function myFunction() {
    if (!functionIsRunning) {
        functionIsRunning = true;
    }
}
Source

Also in JavaScript: