Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript skip default parameter

function myfunc(x,y=2,z=6){
  console.log(x*y);
  console.log(z);
}
myfunc(5) //Output: 10 6
myfunc(5,4,2) //Output: 20 2
myfunc(5,undefined,17) //Output 10 17
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue print date 
Javascript :: js selection box excel node 
Javascript :: padend method in javascript 
Javascript :: define default no cache axios headers 
Javascript :: how to change background image for a webpage 
Javascript :: regular expression match text between quotes 
Javascript :: chrome is not defined 
Javascript :: loop through an array in javascript 
Javascript :: javascript check if is nan 
Javascript :: add leading zeros javascript 
Javascript :: check if array has same values javascript 
Javascript :: for in object javascript 
Javascript :: div click outside to hide javascript 
Javascript :: compare NaN in javascript if condititon 
Javascript :: query selector element with 2 classes 
Javascript :: add variables in javascript 
Javascript :: package.json tilde vs caret 
Javascript :: $(getJson) returning error 
Javascript :: javascript check if boolean is undefined 
Javascript :: trigger send parameter 
Javascript :: jquery trigger event when scroll to div 
Javascript :: read csv file in javascript 
Javascript :: get cookie javascript 
Javascript :: how to import background image in inline css in react 
Javascript :: toggle css class in javascript 
Javascript :: how to check if array is empty or not in javascript 
Javascript :: string replace in javascript 
Javascript :: How to convert data to utf-8 in node.js 
Javascript :: falsy javascript 
Javascript :: ajax post body parameters 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =