Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
you don't have nothing to do, this is look like a syndrome.
no way bruh
"That one guy"? This is the second most popular solution. 😆
there is always that one guy with the arrow functions
This comment is hidden because it contains spoiler information about the solution
Love it!
Implicit returns in arrow functions are dependant on the lack of a body block, not being one-line.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#Function_body
Also arrow functions context differ from regular function expressions and declerations. They follow Lexical scope. I recomend reasearching this difference and when it is better to use an arrow funciton over other ways of writing it. It makes a difference when using the 'this' key word.
the most common use is just to make things shorter. Arrow functions automatically return without specifying 'return' if the function is on one line.
that notation is for ECMAScript 6. We should all use it.
const
is short for constant, which means it will never change. Under normal circumtances, functions can be redefined later, butconst
cannot.As for performance, it depends on the execution engine. If the Javascript is being compiled (as happens on many browsers nowadays), then
const
can be faster than the standardvar
, since the compiler can optimize on the content ofconst
never changing. That being said, you'd probably need a ridiculous Javascript app to actually see the performance benefits, slight as they are.is there any difference between them?
no, it's not
Is the
const funcName = ...
faster thanfunction funcName...
I see it so often here.