📜  缓存需要计算的变量 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:41.682000             🧑  作者: Mango

代码示例1
// 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');