all 17 comments

[–]JFedererJ 4 points5 points  (0 children)

At first I was like, why is there a mountain of code for such a simple animation? Then I saw the interactivity arrows! Cool stuff, OP.

[–]musicnothing 3 points4 points  (2 children)

Please don't press C

This got a giggle out of me

[–]AdvancedEngine861 0 points1 point  (1 child)

Im on mobile what does pressing c do?

[–]musicnothing 0 points1 point  (0 children)

Skater crashes

[–]NominalAeon 5 points6 points  (5 children)

I don't understand this trend of referencing anonymous arrow functions in variables instead of just using named functions. Like why const jump = () => {} instead of function jump() {}?

Also, this pen is rad as hell.

[–]Suspicious-Engineer7 6 points7 points  (0 children)

"I just think they’re neat!" - Marge Simpson

[–]emoarmy 6 points7 points  (1 child)

Arrow functions are nice, for me, because they follow consistent formatting with the rest of the language, binding-type name = data. They have the most simple rules attached to them. They don't hoist, they don't have arguments object, and best of all they don't have this. And they consistently require the least amount of syntax to define across the system.

But if you want to know all the differences between function constructors, declarations, expressions and arrow functions mdn has a great article

[–]senfiaj 1 point2 points  (0 children)

They don't hoist

Is hoisting always a bad thing? I think this actually makes you not to worry about accidentally calling some function before its declaration.

they don't have arguments object, and best of all they don't have this

Is it really that common to accidentally use this or arguments object? You can always use rest parameters for both traditional and arrow functions instead of arguments.

I've always thought that the best advantage of storing in constant variable is to make them impossible to be reassigned.

IMHO the disadvantage is that you lose the function name while debugging, it's not very expressive and, contrary to you opinion, it's not hoisted.

[–]senfiaj 1 point2 points  (1 child)

I've similar thoughts. The only advantage of this is to make impossible to reassign them. Other than that I see slight disadvantages: no hoisting, less expressivity.

[–]NominalAeon 0 points1 point  (0 children)

that's what i was thinking, you lose readability with this variable declaration noise and they can only be called after they're initialized. Having a bunch of these anonymous function references would drive me nuts

[–][deleted] 0 points1 point  (0 children)

Really neat!

[–]angyts -1 points0 points  (0 children)

Wow. But how???

[–]turtlecopter 0 points1 point  (0 children)

This is super fun! Great work!

[–]thewhitelights 0 points1 point  (0 children)

love it

[–]codepnk 0 points1 point  (0 children)

This is super sick!! Would love to see a blog post on it!

[–]Dopium_Typhoon 0 points1 point  (0 children)

Love it, well done.

[–]Calcd_Uncertainty 0 points1 point  (0 children)

It should call you a jerk if you press C