Tell us what’s happening:
I just don’t understand user story 3, am I looking for any phrase of a specific length? any time a phrase of a specific length which appears more than once? Or only if it appears concurrently? (ignore my code tbh, I’m just plain confused)
Your code so far
function isPalindrome(word){
let count = 0;
word= word.toLowerCase()
let wordArray = word.split("")
let j = wordArray.length-1;
for(let i = 0; i< wordArray.length; i++){
if(wordArray[i] === wordArray[j]){
count++
}
j--
}
console.log(count)
if(count === wordArray.length){
return true
}
else{
return false
}
}
function findPalindromeBreaks(words){
let arrayOfIndices = [];
for (let i = 0; i<words.length; i++){
if (!isPalindrome(words[i])){
arrayOfIndices.push(i);
}
}
return(arrayOfIndices)
}
function findRepeatedPhrases(words, phraseLength){
//return all start indices where a sequencce of "phraseLength" consecutive words appears more than once
let indices=[];
let count = 0;
if(phraseLength => words.length){
return indices
}
//check if current word appears at any time
//if it does, then push it
for (let i =0; i<words.length; i++){
//check if indice is already in the indices array
if (!indices.includes(words[i])){
//check if current word repeats at any time
count = 0
for(let j = 0; j<words.length; j++){
if (words[i] === words[j]){
indices.push(j)
}
}
}
}
return indices
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36
Challenge Information:
Build a Proofreading Tool - Build a Proofreading Tool