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.
wow, this is so clean code!
I'm from Indonesian
This is the best practices in my opinion. but...string is iterable , dont need convert to array.
I also thought of using a switch, but as you can see by the comments here, using switch(true) and then doing evaluations in each case is kind of an anti-pattern that can be hard to read and debug.
I would avoid and look for one of the other conditional options in this board.
you did't calculate the avg correctly, as you should add yourPoints in the calculation
u didn't consider your marks while calculating average .
great job!
is there a reason you decided to 's' into an array, instead of just looping through the string?
I'm new.. So, help me understand. By using this block, is it because it's an arrow function that you don't need to use the curly braces to separate the IF's? And I assume that the final return statement is an ELSE, but not needed due to the arrow function as well? Or is the ELSE IF just redundant overall and purely used for readability?
This one is good for beginners
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Three layers of for-loops will hurt performance
This is the best in my opinion. This has the best readability apart from all others above.
To further clarify for those still confused on why passing in
switch(value)
doesn't work, it's because it's comparing a Boolean to a numerical one, which will always befalse
. Say our average is 95 and we're assigning that to a variableavg
. If we try to pass inavg
as the argument to the switch statement's parameter, this is essentially what is happening:(avg >= 90)
is returning a Boolean. We'll never reach a switch statement that evaluates to true if we're passing in ouravg
variable as the argument. I hope this helps!I console.logged
o.split(d)
just to see what I get. It gave me[ '0', '49', '6253649648', '', '00' ]
for input(10, 1)
. Someone plz explain why and how do we get that''
value as the second last element ? I think that must be the reason he/she have applied.length - 1
to the solution and not just.length
. Correct me if I'm wrong and need a proper explanation. But otherwise an excellent solution.Loading more items...