Math, getting started with programming


#1

The Instructions:

we saw basic math before. The basic math symbols we learned in school work here. Even the order in which the computer understands the math is the same as in school!

Code:

  1. ( ): control order of operations
  2. * and /: multiplication and division
  3. and +: subtraction and addition

Examples:

  1. 100/10 evaluates to 10
  2. "Jane".length + 5 evaluates to 9
  3. 5*(3+1) evaluates to 20

Instructions
Complete the missing bits of code to construct the if / else statement. Make the condition evaluate to true.
Finish the else statement by printing out the string "Error Error Error" to the console.


Original Code:


("Jon".length * 2 / (2+1) === )
{
console.log("The answer makes sense!");
}
else


My Code:


if ("Jon".length * 2 / (2+1) === )
{
console.log("The answer makes sense!");
}
else
{
console.log("Error Error Error")
}


I know i must look like a complete idiot but could someone help me? i don't understand what i'm doing wrong.


#2

You're missing a semi colon at the end of console.log("Error Error Error")

also the IF should be if ("Jon".length * 2 / (2+1) === 2)

The full correct code:

if ("Jon".length * 2 / (2+1) === 2)
{
console.log("The answer makes sense!");
}

else {
console.log("Error Error Error");
}


#3

You ought to complete your if statement. if("Jon".length()*2/(2+1)===what?)
Actually it should be if("Jon".length()*2/(2+1)===2). Your === has to have both LHS and RHS


#5