i had create this code fo the function of subLength challenge but the code still return me ‘character is not includes in string’ can someone help me please:
const subLength = (string, char) => {
Just adjust it according to the topic above and it will be super easy to help you!
It really depends on whether you want the counter to be an array of chars or an integer that just increments each time it finds a char in a string. Which one do you want?
Overall it seems like your curly brackets ‘{’ and ‘}’ are a little bit off. That’s where proper code formatting comes in.
For example the code in your post should be formatted like this:
let counter = 0;
for(let i = 0; i <= 10; i++) {
counter++;
if(i === 4) {
console.log('4 is my favorite number!');
}
}