Kata question --- codewars

this is a kata from CodeWars
its passing 6 out of 10… why? pleez?
hints only plz??

// Needing logic to represent any x value in ISBN
// as the integer value 10 

function validISBN10(isbn) {
  let isbnArray = isbn.split("")
  if(isbnArray.includes("X")){
    isbnArray.pop()
    isbnArray.push(10)

    
  }

  if(isbnArray.length !== 9){
    return false
  }
  
  else{
    for(let i = 0; i < isbn.length; i+=1){
      
      let count = 0 + isbn.indexOf(i)

      if(Number.isInteger("i")&& (i <= 10 && i <= 0)){
        count += i;
      }
      else{
      return false
      }
    }
  
    if(count % 11 === 0){
    return true
    }
    
  }
//console.log(isbnArray)
}

I think the best thing to do would be to explain in words, not code, how you think you should solve this. Give us step by step instructions of how your algorithm will work. I’ll give you a hint, I think the first thing you did is just fine. But everything after that needs some work. So let’s make sure you understand how to solve this first before you try to code it.

ISBN are ten digits long, so it should be !== 10 ?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.