for (let i = 0; i < strArray.length; i++) {
if(!strArray.includes([‘+’ , ‘-’ , ’ ']))
{
cleanStrArray.push(strArray[i]);
}
}
}
Problems:
1- i think the code is correct but its not passing through
2-it give me this warning " Your for loop should use !["+", "-", " "].includes() "
3-the warning makes no sense i tried doing what it told me that went nowhere.
So i have a question can someone tell me what is wrong is it my code or is it the testers
Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 22
hi your code is correct but the only problem is your not checking strArray items with the provided for loop and its index that is i so you need to put sth inside the includes() function to work with the loop hope it works I tried not to mention any direct solution for your good.
ok so this is the correct thing if(!strArray.includes([‘+’ , ‘-’ , ’ ']){}but testers say that the inverse is correct someone should really change it cuz it really is confusing. You can look at docs like MDN Web Docs for more examples and to really understand how certain methods work.
ok so i was asleep but this problem is wrong you can go to MdN web docs and search the .include() method. The problem is i think the person who made this step forgot how to use the .includes method so firstly reset your lesson then inside the for make an if statement that has the condition: ![“+”,“-”“”].includes(strArray) (which the test say is right but its wrong still this is how you pass).Then figure the rest from here since we cant give the full solution.
for (let i = 0; i < strArray.length; i++) {
if(!strArray.includes(str[“+”,“-”," "])) {
cleanStrArray.push(strArray[i]);
}
}
}
Thank you very much, I actually had the solution that was in the first post, but after getting the hint by the tester and trying out the solutions on this threads, its become a jumbled mess for me…send help lol