Skip to main content

default parameter for object attr in javascript

function test1(testVar = "testVar", {name = 'my name'}) {
console.log(testVar)
console.log(name)
}
test1(undefined, {phone :'0912-345678'})
function func1({
name='name',
}={}) {
console.log(name)
}