Predict what the pop-up window will say after the following code executes:
var a = 5;
var b = 7;
if (a > b)
{
alert("a is bigger");
}
else
{
alert("b is bigger");
}
Answer: The variables a and b are assigned to 5 and 7, respectively. Since 5 is not bigger than 7, then a is not bigger than be. Therefore, the second alert function occurs, and an alert appears with the text "b is bigger".
Consider the following variable assignments:
a = 100;
b = 75;
c = 25;
d = 1;
e = "Donald"
f = "Duck"
g = "10"
h = "75"
What is the result of the following operations or conditions (remember, operations will result in a string or a number, conditions will be true or false). Identify if the output is a string, a number, or a Boolean value:
a + b
Result:175(number)a % b
Result:25(number)e + f
Result:DonaldDuck(string)e + g
Result:Donald10(string)c * d
Result:25(number)g + h
Result:1075(string)f + g
Result:Duck10(string)d + h
Result:175(string)((b / c) < a)
Result:true(Boolean)((a % b) == c)
Result:true(Boolean)((c > a) || (b < a))
Result:true(Boolean)(h == b)
Result:true(Boolean)