optional arguments javascript
function func(arg, optArg = "defualtValue") {
console.log(arg, optArg);
}
func("A", "B"); //output "A", "B"
func("Test"); //output "Test", "defaultValue"
func(); //output undefined, "defualtValue"
Also in JavaScript:
- moment add 30 days
- jquery alert
- javascript reserved words
- JavaScript that executes after page load
- javascript write to file
- jquery select a dynamic element
- node list files in directory
- running scripts is disabled on this system react js
- moment js check if date is greater than
- javascript try catch finally
- js self driving car
- express js redirect to url
- navigation.openDrawer is not a function react native
- javascript regex .test
- permutation javascript
- node to viewport godot
- react duration picker
- Sending an Ajax request before form submit
- redirect browser javascript
- siblings jquery
- how to block special characters in javascript
- javascript get file extension from string
- how to store variable in javascript
- js esperar um tempo