1/15
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What are valid values for a Boolean
True & False
What is the statement that allows us to run code only if something is true
if statement
What kind of statement allows us to run code if one condition is true but another statement otherwise
if/else statement
function main() {
let isClean = false;
if (isClean) {
console.log ("Thanks for taking care of your space!");
} else { console.log("Time to tidy up!"); }
}
main();
What will be the output of this code?
Time to tidy up!
What symbol represents "and" in coding
&&
What symbol represents "or" in coding
| |
let isSaturday = true;
let isSunday = false;
let isWeekend = isSaturday || isSunday;
After this, what is the value isWeekend?
true
What is the proper way to compare if two values are equal?
==
What is the proper way to say not equal in coding
!=
let flower = "violet";
if (flower == "rose") { console.log ("Roses are red, violets are blue.");
} else { console.log ("A rose by any other name would smell as sweet.");
}
What would be the output of this code?
A rose by any other name would smell as sweet.
let num = 55;
if (num == 3) { circle.setColor("orange");
} else if (num % 5 == 0) {
circle.setColor("yellow");
} else if (num > 50) { circle.setColor("green");
} else { circle.setColor("red"); }
What will be the output for this code
Yellow Circle
let num = 10;
while (num > 0) {
console.log("hello");
num = num - 1;
}
How many times will this print "hello"
10 times
let num = 50;
while (num < 100) { console.log("hello");
}
How many times will this program print "hello"
This will make an infinite loop.
What does the break statement do?
Instantly stops a loop.
for (let i = 0; i < 5; i++) { console.log("hello");
}
How many times will this code print "hello"?
5
for (let i = 0; i < 3; i++) {
let sum = 0;
sum = sum + i;
}
What is the final value of sum in this code?
2