Why do we have to add Null here? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

8th Sep 2019, 8:41 PM
Alexander Schröder
Alexander Schröder - avatar
3 Answers
+ 3
this is in python isn't it?
8th Sep 2019, 9:16 PM
ABADA S
ABADA S - avatar
+ 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
8th Sep 2019, 10:54 PM
Anton Böhler
Anton Böhler - avatar
0
function myFunction(w, x, y ,z){ console.log(w + x + y + z) } //is the fuction
2nd Aug 2020, 11:32 AM
Nihar Kunder
Nihar Kunder - avatar