View Single Post
Old 11-21-2012, 06:53 PM   PM User | #9
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,447
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by rnd me View Post
aw man, you shoulda stopped while you're ahead; you got the ball rollin on this. i did cover the 2nd arg implications in my follow-up to Dormilich's note. or, i should say, i tried...

but, for the sake of accurate info for noobs reading this thread, i must point out that you are dead wrong about this particular point.
Strange because I tested it prior to adding that comment to the end of my post and only added the comment because in the browser I was testing in the value that parameter did make a difference.

The test I did was with my original array with the - sign removed and replacing max with min - and then with the 0 as the second parameter I got the 0 returned instead of the 2 only by changing the 0 to a number bigger than the minimum in the array could I get it to return the right answer. The first parameter to the bind substitutes for 'this' but the second parameter simply got added to the array.

Obviously the implementation of bind varies slightly between browsers. Had my test returned the same result that your's did then I would not have gone back and amended the post to add that sentence. The difference probably relates to the number of objects that the browser considers to be involved that need to have a value supplied for 'this'.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/

Last edited by felgall; 11-21-2012 at 07:54 PM..
felgall is offline   Reply With Quote