Introducing Else If StatementsPassed

Tell us what’s happening:
Describe your issue in detail here.

function testElseIf(val) {
if (val > 10) {
return “Greater than 10”;
} else if (val < 5) {
return “Smaller than 5”;
} else {

return “Between 5 and 10”;
}

testElseIf(7)}

(if write testEslsef(7); ). give me problem

Your code so far


// Setup
var lastName = "Lovelace";

// Only change code below this line
var lastLetterOfLastName = lastName[lastName.length - 1]; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36

Challenge: Use Bracket Notation to Find the Last Character in a String

Link to the challenge:

In the first part of your post there is a nesting problem.

testElseIf(7)}

The } closes the function testElseIf(). The call to the function should be outside the function.

I’m guessing the linked lesson is a different one than the one your question refers to as the code below Your code so far seems correct.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.