© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
J. SimpsonHow JavaScript Works https://doi.org/10.1007/978-1-4842-9738-4_13

13. The Canvas

Jonathon Simpson1  
(1)
Belfast, Antrim, UK
 

So far, we have only dealt with code that is used either directly in JavaScript or on the HTML DOM. Operations to modify the DOM are easy to do in JavaScript, but they are relatively slow when compared to other JavaScript code. You’ll begin to notice these inefficiencies if you have thousands of DOM elements on your page and apply interactions to them using addEventListener. This makes creating DOM-based games or large interactive applications like whiteboards nearly impossible from a performance perspective. At one point, I ...

Get How JavaScript Works: Master the Basics of JavaScript and Modern Web App Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.