function addNums(num1 = 1, num2 = 2) {
console.log(num1 + num2);
}
console.log(addNums());
This code results in an output of:
3
undefined
Where is the undefined coming from?
function addNums(num1 = 1, num2 = 2) {
console.log(num1 + num2);
}
console.log(addNums());
This code results in an output of:
3
undefined
Where is the undefined coming from?
addNums does not return any explicit values, so is implicitly returning undefined, which is being printed on the 2nd console.log statement.