setTimeout()
only run once after certain time period (2s here (2000ms)).
setInterval()
will loop forever until stoped by window.clearInterval()
your code here the timeout will have a delay for 2s then call model.increment();
your code for setInterval will repeat the sec you set at data.secondsToPlantTree
ref:
Window setTimeout() Method
https://www.w3schools.com/jsref/met_win_settimeout.asp
Window setInterval() Method
solved What is the purpose of this js code?