Summary
- nodeValue is a little more confusing to use, but faster than innerHTML.
- innerHTML parses content as HTML and takes longer.
- textContent uses straight text, does not parse HTML, and is faster.
- innerText Takes styles into consideration. It won't get hidden text for instance.
innerText didn't exist in firefox until FireFox 45 according to caniuse but is now supported in all major browsers.
setInterval fires again
and again in intervals, while
setTimeout only fires once.
setTimeout(): It is a function that execute a JavaScript statement AFTER x interval.
setTimeout(function () { something(); }, 1000); // Execute something() 1 second later
setTimeout(function () {
something();
}, 1000); // Execute something() 1 second later.
setInterval(function () {
somethingElse();
}, 2000); // Execute somethingElse() every 2 seconds.