Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion default-parameters-es6/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
function greetES5(message, to) {
// Test parameter values in the function body, specifying a default
to = to || 'DOM';
// OR if (typeof to === undefined) { to = 'DOM'; }
// OR if (typeof to === 'undefined') { to = 'DOM'; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think undefined is right, because comment says, if to is undefined then to = 'DOM'. means if to is falsy value undefined then assign 'dom' into to.

// OR if (arguments.length === 1) { to = 'DOM'; }
ChromeSamples.log(message + ', ' + to);
}
Expand Down