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.
TL;DR, it all depends on who you are writing the code for. Personally, I enjoyed it but wouldn't write it.
This feels like an age old argument between concise and readable code. To a complete beginner this would not be very useful or accessible. For me, knowing some JS and a week into learning Python, it is not readable but fun and interesting to dissect and understand, and it helps me to learn. Thank you. And I can easily understand that this becomes quite obvious with time.
Already raised as issue
This comment is hidden because it contains spoiler information about the solution
How so? What is Python all about if not abusing built-ins?
Why would I want to? I've already said this kata has nothing new to offer, and I'm not going to waste my time reimplementing the stuff I've written a dozen of times already. And, of course, not my fault that the tests allow such a thing.
Yes, that's what I meant.
Initializing it: setting its initial value <- You didn't do this at first.
You didn't initialize
temp
and you're trying to settemp[j]
. That's the error you're seeing. Then you'll have to fix some other problems.Post your code, mark your post as having spoiler content. You must be doing something wrong, because I tested the kata with a loop and returning
true
and it doesn't give a TypeError.Unless you converted
n
to astring
, numbers haven't alength
property.hi, why answer.splice(index,1); ??
till now o could not pass any chalenge. very disapoited with myself. seems that js it's impossible to me.
sort
sorts in place. Assigning it to itself does not prevent that. Either way will modify the input. You have to copy the input and sort the copy. That is the only way if you want to use the built-in sort.This would modify the input. Here it's not dangerous, but this could lead to unexpected problems.
No problem, I'm used to being ignored :P
var answer = numbers;
does not create a copy, it's just another reference to the same array, so sadly, "fix your code", because you're mutating the input array. You can see you're mutating numbers writing the console.log line as the first line of your function too.Also, please read my post two posts below yours, I wrote it for people like you that doesn't understand the mutation test.
read the description again, you forgot something. ;)