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.
The cleverest practice!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Nice!!
Yeah, but it was just a coincidence that I had just seen bitwise being explained to me on leetcode in their video solution for this problem.
https://leetcode.com/explore/featured/card/the-leetcode-beginners-guide/692/challenge-problems/4425/
I thought it was pretty cool and looked it up, then I seen it in your solution here on the same day
When writing real code, clarity is the most important rule in practice, beyond doing smart tricks. You do NOT need to use bitwise operations in non-bitwise-based logic. We only did it because we're used to code golfing.
I have just learned about bitwise operators today. I will, like you, start using them in practice.
Well done
brings tears to the eyes. quite lovely!
from javascript.info
"
But if there is a return statement, then the rule is simple:
If return is called with an object, then the object is returned instead of this.
If return is called with a primitive, it’s ignored.
In other words, return with an object returns that object, in all other cases this is returned.
"
I think this is the most clever solution I've seen.
Not sure, but I think beceause as soon as you call the NameMe function you will get the object back that is returned inside NameMe. So it will only get you the name. But if you return nothing you will get "this", so the NameMe object itself.
A perfect solution
This is one of my favorite iterations - lead me down a rabbit hole on MDN looking for new ways to refactor some old code.
Love the reset after output!! So clever.
Loading more items...