It would be simpler without the grade variable.
You can just return the value directly.
I also suggest using more spaces and not writing if(x) which looks like a function call.
function getGrade (score) {
if (score <= 5) {
return "F";
} else if (score <= 10) {
...
}
}
Likewise here, although here we can also use better variable names.
function getLetter (string) {
const letter = string[0];
// Write your code here
switch (true) {
case 'aeiou'.includes(letter):
return 'A';
case 'bcdfg'.includes(letter):
...
}
}
You already know that includes works on strings, so why stop now?
And let's use const if you're not going to reassign something.
function vowelsAndConsonants (string) {
const vowels = 'aeiou';
...
}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It would be simpler without the grade variable.
You can just return the value directly.
I also suggest using more spaces and not writing if(x) which looks like a function call.
Likewise here, although here we can also use better variable names.
You already know that includes works on strings, so why stop now?
And let's use const if you're not going to reassign something.