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.
Think I have some adviсes for your code. Firstly you receive an infinite loop because when the space are added to position whith index i+1 (btw you don't need use construction "array.indexOf(array[i + 1])", just "i+1") in the next round of your loop you will examine element of array which contents this just added space. Space satisfies condition of your if, your script will add enother space to next position and examine it in the next round. You will never come to else branch.
You must move on to position after just added space in next round. Add "i=i+2;" after "array.splice...;" (+2 because you don't need to examine space and next standing uppercase letter). And remove your else branch. Another thing: in condition of your loop you must handle elements only up to "i < array.length-1". The last element will be examinated in the penultimate round.
This comment is hidden because it contains spoiler information about the solution
Change
x
tothis
because prototypes work as a function of the string class. Your code is failing becausex
is "undefined" because it doesn't require a parameter - it instead calls the "digit" function that a string now has (look up prototypes, and look at the testcases to see what I'm talking about). You can see this if you console.log(x) and console.log(this) just before your if statement.Put
console.log(this)
in your code so you can see the input parameter. Your code is failing because it returns false if it is type string...but all the parameters should be a string to be a digit.@ginnk
,Have you tried looking at your profile page and clicking on the
Kata
tab? There are options forCompleted
andUnfinished
katas.