Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

what is the meaning of [...args]in js

/*With respect to*/ (...args) =>//, ...args is a rest parameter. 
//It always has to be the last entry in the parameter list and 
//it will be assigned an array that contains all arguments that 
//haven't been assigned to previous parameters.

//It's basically the replacement for the arguments object. Instead of writing:

function max() {
  var values = Array.prototype.slice.call(arguments, 0);
  // ...
}
max(1,2,3);

//you can write

function max(...value) {
  // ...
}
max(1,2,3);

/*Also, since arrow functions don't have an arguments object, 
this is the only way to create variadic (arrow) functions.*/
Comment

PREVIOUS NEXT
Code Example
Javascript :: parseint javascript online 
Javascript :: javascript palindrome check 
Javascript :: NodeJS Database initialisation 
Javascript :: js how to get random number (inclusive min max) and push it in an array 
Javascript :: Create A Class That Returns A Promise In Constructor 
Javascript :: node-red function string to int 
Javascript :: add array and sort 
Javascript :: 1--Reverse Bits Algo 
Javascript :: how to skip the else statment in react tertiary 
Javascript :: prisma is and isNot 
Javascript :: how to store new object made by constructor classes data in local storage using javascript 
Javascript :: Jquery works only on double click 
Javascript :: wp include js 
Javascript :: sort items 
Javascript :: Backbone Model Fetch 
Javascript :: In express redirect user to external url 
Javascript :: simple JSX example 
Javascript :: Solution-4-B--solution options for reverse bits algorithm js 
Javascript :: react native componentdidmount in function 
Javascript :: callback function jquery 
Javascript :: text inside image react native 
Javascript :: moment now 
Javascript :: javascript add item to array 
Javascript :: remove backslash from json 
Javascript :: usecontext multiple provider 
Javascript :: stripe confirm card payment {ESNext} 
Javascript :: javascript Non-numeric String Results to NaN 
Javascript :: javascript rest parameter 
Javascript :: Create JavaScript Generators 
Javascript :: set up express server and scraper 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =