This forum is now read-only. Please use our new forums! Go to forums
How do You pass This???????
**I put my code as this : var red = [0, 100, 63]; var orange = [40, 100, 60]; var green = [75, 100, 40]; var blue = [196, 77, 55]; var purple = [280, 50, 60]; var myName = “Arnab”; var letterColors = [red, orange, green]; if (1 + 1 = 2) { bubbleShape = “circle”; };
else { bubbleShape = “square”;
}; drawName(myName, letterColors);**
And it says Make sure you have defined all variables. It keeps saying it every time I try. How do you pass it????????
Answer 54e115de51b887275a007269
Hello Arnab :)
Semicolons are used to mark the end of a single instruction (like assignment instruction or function call), not a block of code (code enclosed between {
}
). So, we do not want semicolons after if
or else
.
Usually inside parentheses after if
we place a boolean expression (statement which can be true or false). In math 1 + 1 = 2
is a valid, true statement, but not in JavaScript. This is caused by =
character which is used only to assign. If you want to compare something you have to use comparison operator - ==
.
Corrected code:
var red = [0, 100, 63];
var orange = [40, 100, 60];
var green = [75, 100, 40];
var blue = [196, 77, 55];
var purple = [280, 50, 60];
var myName = "Arnab";
var letterColors = [red, orange, green];
if (1 + 1 == 2) {
bubbleShape = "circle";
} else {
bubbleShape = "square";
}
drawName(myName, letterColors);
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency