General Flashcards
ES6
ECMAScript 6, also known as ES6 and ECMAScript 2015, was the second major revision to JavaScript.
JS 2015 = ES6 = ECMAScript 2015
ECMAScript is the standard, JS is implementation
Babel
ES6 has to be implemented by the browser to be able to run it. Since it’s not always the case - we need to run our ES6 code through Babel, which transpiles it down to something else like ES5 code
run something at intervals (timer)
setInterval(function_reference, every_millisec)
setInterval(this.tick, 1000) //once every second
when started for the first time, the method will wait every_millisec and only then start function_ref
so to avoid this - you have to call the function once before setInterval
this.tick()
setInterval(this.tick, 1000) //once every second
the method returns a timer object
const timer = setInterval(this.tick, 1000) to stop the timer we call
clearInterval(timer);