samedi 4 août 2018

node.js doesn't continue after function in if-statement

This snippet of code gets executed until the end of the getRefreshToken function is at its last line. The play_song function does not get triggered. Am I misunderstanding the way JS works? For now I have included the call to play_song at the end of the getRefreshToken function, and of course that works as expected. However I am very confused why it doesn't just execute function after function in the if-statement.

function checkTime () {
 var now = new Date();
 if (now.getHours() == time[0] && now.getMinutes() == time[1]) { 
  getRefreshToken();
  play_song();
 }
}

Aucun commentaire:

Enregistrer un commentaire