A default argument can reference a prior argument.
const defaultFunc = (num1,num2=num1) => {
console.log(`num1: ${num1} num2: ${num2}`)
}
defaultFunc(3) // num1: 3 num2: 3
defaultFunc(3,6) // num1: 3 num2: 6
A default argument can reference a prior argument.
const defaultFunc = (num1,num2=num1) => {
console.log(`num1: ${num1} num2: ${num2}`)
}
defaultFunc(3) // num1: 3 num2: 3
defaultFunc(3,6) // num1: 3 num2: 6
For further actions, you may consider blocking this person and/or reporting abuse
Grzegorz Dubiel -
Sanjay Kumar Sah -
Sagar Das -
TheDev -
Top comments (0)