+ 3

Explain please method .apply() in js

Can someone explain to me the method .apply() in js? I have read in the Internet...I was even able to apply it Math.max.apply (null, arr), where arr is an array of numbers, and this method pulls from an array the maximum number, but how the method works by itself I did not understand.😓

25th Jan 2018, 7:28 PM
Vitaliy Angelov (Rostov-on-Don)
Vitaliy Angelov (Rostov-on-Don) - avatar
1 Answer
+ 1
This is a good question, and I don't think I would do a better job describing it than W3C. First look at this page to review the Call method. https://www.w3schools.com/js/js_function_call.asp. Then have a look at their explanation of Apply here, https://www.w3schools.com/js/js_function_apply.asp. Sorry that is the best I can do, I hope it helps!
26th Jan 2018, 2:17 AM
Michelle Dougenik
Michelle Dougenik - avatar