Why do we have to add Null here? | Sololearn: Learn to code for FREE!

+1

Why do we have to add Null here?

myFunction.apply(null, args.concat(4)); Why do we have to add null here to not cause an error?

9/8/2019 8:41:21 PM

Alexander Schröder

3 Answers

New Answer

+3

this is in python isn't it?

+2

the function you have probably expects a object and if it doesn't get it, an error occurs. null can be parsed instead of an object

0

function myFunction(w, x, y ,z){ console.log(w + x + y + z) } //is the fuction