Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

cache variables that need calculation

// In the case of a jQuery selector, we could cache the DOM element.

let navright = document.querySelector('#right'); 
let navleft = document.querySelector('#left'); 
let navup = document.querySelector('#up'); 
let navdown = document.querySelector('#down');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cache #variables #calculation
ADD COMMENT
Topic
Name
5+8 =