Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

How javascript spread operator works?

var num = [2, 4, 6, 8, 10];
console.log(...num)
//expected output: 2 4 6 8 10
console.log(88, ...num, 99) 
// added extra new elements before and after the spread operator
//expected output: 88 2 4 6 8 10 99
Comment

Spread Syntax for function

myFunction(...iterableObj); // pass all elements of iterableObj as arguments to function myFunction
Comment

Spread syntax in ES6

let arr1 = [1, 2, 3]
let func = (a, b, c) => a + b + c

console.log(func(...arr1)) // 6
Comment

How to Use the Spread Operator in JavaScript

const newArray = ['firstItem', ...oldArray];
Comment

Spread syntax (...)

myFunction(a, ...iterableObj, b)
[1, ...iterableObj, '4', 'five', 6]
{ ...obj, key: 'value' }
Comment

PREVIOUS NEXT
Code Example
Javascript :: element vs node 
Javascript :: how to run the counter when we reach at a specific section in jquery 
Javascript :: swift read json from url 
Javascript :: como usar for js 
Javascript :: filter syntax 
Javascript :: javascript random function 
Javascript :: enable bootrstrap duellistbox from my own js 
Javascript :: catch the last item in a array js 
Javascript :: create model Obejctid mongoose 
Javascript :: Datatable search input with no label - just the placeholder 
Javascript :: React.createElement pass props 
Javascript :: select triggers mouseleave 
Javascript :: rebuild package-lock.json 
Javascript :: node.js how to install a custom version of packgage 
Javascript :: react native parent opcaity not affecting text 
Javascript :: node load testing-01 
Javascript :: my env.local file not working in my react app usind mac 
Javascript :: count number of vowels in a string javascript 
Javascript :: how to replace import with require 
Javascript :: nodejs s3 read 
Javascript :: iterate set javascript 
Javascript :: remove anything through bubbling 
Javascript :: petru a retuna toate toate datele in java script 
Javascript :: jquery escape 
Javascript :: how to manually sort array javascript 
Javascript :: javascript interview quetions 
Javascript :: set npm push proxy 
Javascript :: decrypt javascript code 
Javascript :: js destructuring arguments 
Javascript :: nestjs run tests 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =