jeudi 12 décembre 2019

Timing an if-statement in JavaScript

My idea is to build a program that is completely timed and runs on it own, without any input from the user. However I want to use if-statements in the form of:

if(height()>10){ do something }

height() itself is a function and does something as well. call() is just another function that has to be invoked but is also timed with setTimeout. I want the return to be invoked after everything in call() is executed. However

function () height() {call(); setTimeout(function() { return client._lastAltitude;},1000);}

does not return the proper value or does not work the way I thought it would. Is it possible to time a return statement so that the if-statement is halted?

Aucun commentaire:

Enregistrer un commentaire