**Why put "null" in this code?**

var arr = [6, 89, 3, 45];
var maximus = Math.max.apply(null, arr); // returns 89 and Can i do this with (arr, null) ?

The first argument of apply method binds context to different function/class constructors. You can replace null with window, which is the global object that arr belongs to and it will return the same result.

You can read more about it here.

1 Like

Thanks for the share Phillip, its quite helpful :slight_smile: :slight_smile:

Regards…