Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

skip arguments in js

function userInfo(firstName, lastName, userName){
  // other logic stuff
    console.log(firstName, lastName, userName);
}
// skip lastName argument using: ...[,] and it's mean undefine
// 1 argument for ...[,] 2 arguments for ...[,,] and so on.....
userInfo('JavaScript', ...[,], 'js');
//it's mean => firstName: JavaScript, lastName: undefined, userName: js
 
PREVIOUS NEXT
Tagged: #skip #arguments #js
ADD COMMENT
Topic
Name
5+7 =