- #1
shivajikobardan
- 674
- 54
- TL;DR Summary
- codewars kata not passing tests
I'm doing this kata.
https://www.codewars.com/kata/520b9d2ad5c005041100000f/train/javascript
My code isn't passing a test. Please help fix the issue.
It works as expected so why is it not passing the tests?
https://www.codewars.com/kata/520b9d2ad5c005041100000f/train/javascript
JavaScript:
function pigIt(str) {
const words = str.split(" ");
for (var i = 0; i < words.length; i++) {
if (words[i] === "!") {
return "!";
}
var firstLetterSliced = words[i].slice(0, 1);
var remainingLetterSliced = words[i].slice(1, words[i].length);
return (remainingLetterSliced + firstLetterSliced + "ay");
}
}
pigIt('Pig latin is cool'); // igPay atinlay siay oolcay
My code isn't passing a test. Please help fix the issue.
It works as expected so why is it not passing the tests?
Last edited by a moderator: