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.
Exactly what i did!
this one is nice - should be the top
'п"ять'.replace('п"', 'бл')
Clean! +1
I like this because it's readable and clean. Easy to see what's happening without having to parse out more complex nested bits.
This comment is hidden because it contains spoiler information about the solution
Would fail on
null
becausetypeof null
=== "object"clone the array before modifying it! this is the best practice 🙂
This won't work. For example: isOpposite('aa','dd') is true.
Decent enough solution, but readability isnt great, you could have formatted it in an easier to read style but nested ternaries are always hard to read properly.
something like this perhaps
return operation === "+"
? value1 + value2
: operation === "-"
? value1 - value2
: operation === "*"
? value1 * value2
: operation === "/"
? value1 / value2
: false;
Did you know that you can use
||
after an expression, and then if that one is 'falsy' (is 0, '', doesn't exist, see more on the Mozilla website) it uses the one after. So instead of including a bunch of edge cases in the database, you could do:lang[language] || 'Welcome'
.