Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript assign multiple variables to same value ES6

const [
  moveUp,
  moveDown,
  moveLeft,
  moveRight,
  mouseDown,
  touchDown
] = Array(6).fill(false);

console.log(
  moveUp,
  moveDown,
  moveLeft,
  moveRight,
  mouseDown,
  touchDown
); // will assign all the variables from lines 11-16 to false
Source by thewebdev.info #
 
PREVIOUS NEXT
Tagged: #javascript #assign #multiple #variables
ADD COMMENT
Topic
Name
9+2 =