function aaa() {
return
{
test: 1
}
}
console.log(aaa());
Why this code result is undefined? I assume is will be object.
function aaa() {
return
{
test: 1
}
}
console.log(aaa());
Why this code result is undefined? I assume is will be object.
Because when you change the line it terminate the statement so you have to put curly bracket after return
to make it work.
Just use this:
function aaa() {
return {
test: 1
}
}
console.log(aaa());