Where is the mistake?


#1

please help me.
https://www.codecademy.com/courses/javascript-beginner-fr-FR-ry8va/2/6

Where is a mistake (unespected token else)
/ Vous ne savez pas par où commencer ? Regardez l'indice !
if("ABCD.length===4");
{
console.log( "J'ai fini mon premier cours !" );
}

else("ABCD.length===5");
{
console.log("undentified");


17/28 JavaScript french
#2

Hello, @andisor!
I'm not a Java programmer but the syntax of it reminds me a bit of C++.
Whenever we have an else statement, we consider that all the possible conditions have been tested and the last one, sometimes the error, is executed in the body of the else statement so in this case there's no more comparision of values.
The values that willl be tested, which are inside the if statement shouldn't be a string, otherwise it won't be able to check if the condition is True or False, so you might want to change that.

If there's more than one possible condition, lenght equal to 4, 5, 6, or even more, and each condition has a different message to be printed, use if's. (plural for if)
Check the following link for more info about it: If - Else.

Hope that helps you!


#3

Thank you for your advice.Regards


#4

No problem, Andisor! Glad to help!


#5

Though your question is regarding javascript, refer this resource with some beautiful explanation for logic.