Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Oh haha thanks! Got it.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Sorry I'm not sure I understand what you mean. I thought x was the parameter? I am looking up how to add properties and methods to String.prototype and everything I search looks similar to my code. I tried adding "this.x = x" and "this.digit = x" at the beginning because I thought that was what you were getting at but it didn't change my results.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Hi all, I am new to javascript and am having trouble with the Split Camelcase kata.

    Description:

    Split a camelcase string into individual words, the return value must be a single string of words seporated by one whitespace.

    The strings are to be split on the capital letters like so:

    'StringStringString' => 'String String String'

    **I completed this with no problem, but what it doesn't mention in the instructions is that if two or more capital letters are next to each other, you only add a space before the first capital letter. So "TTThisIsAnExample" would become "TTThis Is An Example" and not "T T This Is An Example" ... if that makes sense. So this is the suuper inefficient code I wrote to try to satisfy those tests, but apparently it is an infinite loop and I have no idea why:

    function splitter(str){
    let array = str.split('');
    for (let i=0; i<array.length; i++) {
    if(array[i] === array[i].toLowerCase() && array[i + 1] === array[i + 1].toUpperCase()) {
    array.splice(array.indexOf(array[i + 1]), 0, " ");
    } else if(array[i] === array[i].toUpperCase() || array[i] === " ") {
    continue;
    }
    }
    return array;
    }

    I would appreciate any help people could offer on this code. Thanks!

  • Default User Avatar

    I never clicked on "train" so it was never added to my unfinished kata. Thanks though!

  • Default User Avatar

    Hi all, not sure if I am asking this question in the right topic section - but I completed a kata asking to remove all the strings from a mixed array. I was accidentally logged out when I submitted my solution and once I logged in I could no longer find that kata. I would like to submit my solution! If anyone knows the name for the kata could you let me know please? You need to create a filter function that removes all the strings from a mixed array and returns a new array with only the numbers.
    Thanks.