Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript remaining elements of an array to a variable using the spread syntax

const arrValue = ['one', 'two', 'three', 'four'];

// destructuring assignment in arrays
// assigning remaining elements to y
const [x, ...y] = arrValue;

console.log(x); // one
console.log(y); // ["two", "three", "four"]
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript typeof operator returns function 
Javascript :: javascript Read Only View of an Object 
Javascript :: JavaScript pauses the async function until the promise 
Javascript :: javascript Undeclared variable is not allowed 
Javascript :: JavaScript Generator Function With return 
Javascript :: javascript Number() Method Used on Dates 
Javascript :: status role discord.js 
Javascript :: !Object.construct polyfill 
Javascript :: node js - excecute a child process and exchange message to and from 
Javascript :: lookup in other document in array 
Javascript :: promise limit time 
Javascript :: nodejs: express, morgan, mongoose package 
Javascript :: get page scrolling amount js 
Javascript :: node add dependency 
Javascript :: phaser set alpha 
Javascript :: phaser pause animation instances 
Javascript :: unicons add all icons 
Javascript :: Opposites attract 
Javascript :: string variable 
Javascript :: mobile angular service 
Javascript :: js replay animation 
Javascript :: react native version 
Javascript :: json validate 
Javascript :: useselector 
Javascript :: mongodb find and update array item by id 
Javascript :: Filtering an array for unique values 
Javascript :: change url without reloading the page 
Javascript :: check if file exists javascript 
Javascript :: how to convert json to object 
Javascript :: Working of Recursion in C++ 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =