DEV Community

Discussion on: Mastering Hard Parts of JavaScript: Callbacks I

Collapse
 
internettradie profile image
Ryan Ameri

Thanks for picking that up! Should be fixed now 😀

Collapse
 
semigradsky profile image
Dmitry Semigradsky

if (Object.keys(arguments).length > 2) {

I think you can just use arguments.length. Cheers!

Thread Thread
 
deryckhenson profile image
Deryck Henson

better yet, typeof initialValue !== 'undefined' so you avoid touching arguments at all

Thread Thread
 
semigradsky profile image
Dmitry Semigradsky

initialValue can be undefined

Thread Thread
 
deryckhenson profile image
Deryck Henson

yes...but accum = initialValue loses its purpose if it is.