Java Script


#1

Math
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:

( ): control order of operations
* and /: multiplication and division
- and +: subtraction and addition
Examples:

100/10 evaluates to 10
"Jane".length + 5 evaluates to 9
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.
?
Hint
There is a lot of left out syntax. The if keyword and the { } after the else keyword are all left out.

Make sure not to delete any of the provided code. It could cause your code to fail!

Oops, try again. It looks like 'Jon' on line 5 was not defined before it was used. This means either you need to define it, 'Jon' is spelled incorrectly or you need quotes around 'Jon'.

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


#2

Please ask questions instead of copying the exercise


#3

Look I have always done thisand if you can solve it for me please do and if you are unhappy for me to do this then why dont you complain to sombody else becasue I dont need these complaints ok. all I ask for is a bit of help then I get you commenting a complaint.


#4

There's nothing to reply to, you're not asking for anything, you're not explaining what the trouble is.

It's a bit like grabbing your homework and putting it in front of someone while saying nothing -- and expecting them to do something with it


#5

ok look im sorry just little bit annoyed why it wont work if you can just bare with me whie i try to write an explanation


#6

basicall the highlighted section is what i had to do and the section bellow the // notes is my code and it tells me to write those and that is what i did then it told me when i pressed the save and run to...


#7

There's an example at the bottom of the instructions, which suggests how to do what they're asking for, it doesn't quite match what you're doing


#8


#9

oh XD sorry just sin ur reply just gonna take another look m8


#10

thanks for being patient


#11

What they want you to do is to use .substring(). For example, for the first string you should use

console.log("January".substring(0,3);

Remember that the 0 stands for the first character in the substring.


#12

console.log("Melbourne".substring(0, 16) );
Melbourne needs to be in Melbourne is great and im not sure where I went wrong


#13


#14

You need the full string. not just the words. Use the .substring() method to get the words.


#15

They want you to use the substring method to print out the first 12 characters of "Melbourne is great".


#16

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.