how to check if function is running js

Solutions on MaxInterview for how to check if function is running js by the best coders in the world

showing results for - "how to check if function is running js"
Laura
25 Apr 2019
1var functionIsRunning = false;
2
3function myFunction() {
4    if (!functionIsRunning) {
5        functionIsRunning = true;
6    }
7}
Magdalena
11 Oct 2020
1function getdata(){
2var cityName = document.getElementById('data').value;
3fetch("https://api.openweathermap.org/data/2.5/weather?q=karachi&appid=fe09716e3af279e3e7bcc6c136b6f6a2")
4.then((response) => {return response.json();
5}) 
6
7 .then(data => {
8console.log(data);
9 })