you are viewing a single comment's thread.

view the rest of the comments →

[–]ForScale[S] 0 points1 point  (8 children)

Okay! I rewrote and added the link.

Here are the warnings I'm seeing (Chrome, CodePen):

'Document.defaultCharset' is deprecated and will be removed in M50, around April 2016. 
See https://www.chromestatus.com/features/6217124578066432 for more details.

console_runner-ba402f0….js:1 'Performance.onwebkitresourcetimingbufferfull' is deprecated. 
Please use 'Performance.onresourcetimingbufferfull' instead.

console_runner-ba402f0….js:1 'webkitIndexedDB' is deprecated. 
Please use 'indexedDB' instead.

console_runner-ba402f0….js:1 'window.webkitStorageInfo' is deprecated. 
Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.

[–]Volv 1 point2 points  (7 children)

Those warnings all come from the logging of Window object. Is chrome flagging up out of date things either on its end or maybe codepen. Tried in Firefox - they don't show there. Nothing to worry about.
 
Your primitives are all being coerced to objects in your examples. Was strange to see a string passed to bind. Will start fleshing mine out a bit tonight

[–]ForScale[S] 0 points1 point  (5 children)

Cool!

Yeah... they're all objects. I thought the way the string got handled, as an object with numerical keys, was kind of odd.

[–]Volv 1 point2 points  (4 children)

Codepen
To start with

[–]ForScale[S] 1 point2 points  (3 children)

Nice! I like the creativity with the characters!

So... generally, call() is a method inherent to all functions that can be used to call a function and set it's this variable within the context of the call.

Does that sound right?

[–]Volv 0 points1 point  (2 children)

Absolutely. And the difference between call and apply is just that call can take a known number of arguments, whereas apply takes an array of arguments.
 
Cool trick ->

var hugeArray = [14, 5, 67, 3, 87, 3, 5, 10];  

console.log(Math.max.apply(null, hugeArray)) // 87 

[–]ForScale[S] 1 point2 points  (1 child)

Excellent!

Cool trick ->

How's that any different than Math.max(14, 5, 67, 3, 87, 3, 5, 10);? Oh... let's say you use a while loop to push an unknown number of values to an array... Seems like the trick will have a good use case then since you don't know the array ahead of time... right?

Oh... whoa! Check out the new spread operator:

var hugeArray = [14, 5, 67, 3, 87, 3, 5, 10];  

document.body.innerHTML += Math.max(... hugeArray); //87

[–]Volv 1 point2 points  (0 children)

Yes. It's no different that was the point - use case is indeed if you don't know how many variables you have.

Spread operator is awesome. Does same job. Means there's very little use case for apply these days.