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.
So I wasn't the only one who had the idea to make a Kata for this after watching that video!
I love this one, the concept of filtered searches has many applications in real software!
You don't even need the
list(input_)
, it can just beinput_
because strings already behave the same as lists!Looking back two years later, I realize my mistake. Thanks for this!
Thanks for letting us know, I guess?
Oh my lord! There's.. so much.
Your code wasn't returning an array.
You get a similar error with the initial code:
The testing part assumes your function returns an array and tries to sort it, hence the error.
It was coming because instead of return statement I was printing the output using console.log(). It has nothing to do with sorting cause I was not using any sort array method. The code had only 30 lines of code and it was pointing error at lines 63 and 88, How is it even possible.
Add print or put in your code, check where it is failing (it's in the line 7).
This comment is hidden because it contains spoiler information about the solution
('dan', not 'kyu' ;p )
it apparently comes from your code: you're trying to sort an array that, at some point in the executions, isn't actully an array anymore.
Anyone know why I am seeing this.
TypeError: Cannot read property 'sort' of undefined
at testAnagrams
at /home/codewarrior/index.js:63:13
at /home/codewarrior/index.js:88:5
at Object.handleError
STDERR
/runner/frameworks/javascript/cw-2.js:237
throw ex;
^
TypeError: Cannot read property 'sort' of undefined
at testAnagrams (/home/codewarrior/index.js:56:18)
at /home/codewarrior/index.js:63:13
at /home/codewarrior/index.js:88:5
at Object.handleError (/runner/frameworks/javascript/cw-2.js:233:11)
at Object. (/home/codewarrior/index.js:3:6)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at [eval]:1:1
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at Object.runInThisContext (vm.js:139:38)
at Object. ([eval]-wrapper:6:22)
You don't know anything you're only at 1 Kyu!
In all seriousness, I understand what you mean. I looked at the other (top) answers and, as always, they're more concise and optimized. This is just the way I first thought of doing it.
Marked as spoiler.
This is a very bad approach, actually. There are way better ways to handle this, without any dict. So providing this is just inviting other users to lazyness... ;p
Loading more items...