Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Javascript :: //Splice remove and add new elements in an array in javascript 
Javascript :: express project structure 
Javascript :: Update failed: ChunkLoadError: Loading hot update chunk app failed. 
Javascript :: material ui navbar 
Javascript :: sort array in ascending javascript 
Javascript :: filter data from object 
Javascript :: jquery table header agnostic of scroll 
Javascript :: react-particles-js not working 
Javascript :: react video srcobject 
Javascript :: react js if statement 
Javascript :: how to select all div with data attribute 
Javascript :: Object Property Shorthand javascript 
Javascript :: length array 
Javascript :: react usecallback hook 
Javascript :: draft js insert text example 
Javascript :: pagination react 
Javascript :: how to print 1 to 10 table in javascript 
Javascript :: array.length in mongoose query 
Javascript :: save js 
Javascript :: re init data vue js 
Javascript :: js example 
Javascript :: JavaScript querySelector - By Tag name 
Javascript :: smtp testing 
Javascript :: get last element in array javascript 
Javascript :: react hook form 
Javascript :: axios get array of urls 
Javascript :: load js 
Javascript :: object loop javascript 
Javascript :: hide show object in react 
Javascript :: passing json as datasource to jasper report library 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =