Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

function x(a) vs function x(...a) the difference

function x(a)
{console.log(a[0]);
/*for a= ['b','c','d']  a[0] will be b*/
}
function x(...a)
{
console.log(a[0]);
/*for a= ['b','c','d']  a[0] will be ['b','c','d'] to get b you will need a[0][0]*/
/*in second case, the first array has only one term: the a array itself*/
}
 
PREVIOUS NEXT
Tagged: #function #function #difference
ADD COMMENT
Topic
Name
1+7 =