• Custom User Avatar

    resolved it, do not ignoring zero.

  • Custom User Avatar

    issue resolved by removing if condition to ignore zero .
    Thanks for and quick reply

  • Custom User Avatar

    You already passed the kata, read this for the next time you post code, please: https://docs.codewars.com/training/troubleshooting#post-discourse

  • Custom User Avatar

    same with my code. Passing test but not attempt.

  • Custom User Avatar

    my below code passing test but not pass Attempt. Please help me to resolve the bug.

    function persistence(num) {
    //code me
    //console.log(num);
    if (num > 9) {
    let valueOfMultiplication = num ;
    // console.log(num);
    let multiplicationCounter = 0;
    while(valueOfMultiplication>9){
    const convertedToString = valueOfMultiplication.toString();
    // console.log(convertedToString);
    let multiplicationVariable = 1;
    let stringToInt;
    for (i = 0; i < convertedToString.length; i++){
    stringToInt = parseInt(convertedToString[i]);
    // console.log(stringToInt);
    if (stringToInt != 0) {
    multiplicationVariable = multiplicationVariable * stringToInt;
    }

              //  console.log(multiplicationVariable);
            }
            multiplicationCounter = multiplicationCounter + 1;
        //console.log(multiplicationVariable);
         valueOfMultiplication = multiplicationVariable ;
        }
        return multiplicationCounter;
       
    }
    

    else{
    return 0;
    }
    }
    console.log(persistence(7647280));