javascript check if argument is passed
function func(arg1, arg2) {
if (typeof arg2 === "undefined") {
arg2 = "defaultValue";
}
//Rest of function
}
javascript check if argument is passed
function func(arg1, arg2) {
if (typeof arg2 === "undefined") {
arg2 = "defaultValue";
}
//Rest of function
}
javascript check if argument is passed
function addition(arg1, arg2) {
if (typeof arg1 === "undefined" || typeof arg2 === "undefined") {
arg3 = "Please Give Me Default Value";
document.write(arg3);
console.log(arg3);
} else {
var arg1;
var arg2;
var arg3 = arg1 + arg2;
document.write(arg3);
console.log(arg3);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us