Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

pass infinite argument in function

/*The rest parameter syntax allows a function to accept an indefinite
number of arguments as an array, */

function getFirstElementOfArray(...args){
  return args[1]
}

getFirstElementOfArray("shirshak","Sabtech","Javascript")// return shirshak
 
PREVIOUS NEXT
Tagged: #pass #infinite #argument #function
ADD COMMENT
Topic
Name
9+7 =