Quiz Question

I keep getting this question on the quiz and I don’t know what it wants me to do “Fill in the blanks to perform a series of arithmetic operations and print the results of each operation.”

What series of operation, add, subtract multiply? What should the result be? How do I figure this out?

I don’t remember learning this anywhere in the material except the little bit about math operators, where can i review this concept? The cheatsheets don’t cover things this hard.

This quiz is basically asking you to fill in the blanks in a common sense manner. For example, for the last one (console.log(myVar ___);), you wouldn’t put the const question, as that would throw a syntax error. The same sort of logic applies to the rest of them-what option would make sense in each blank?
I hope this helps!

I understand the idea of filling the blank. I don’t understand what it wants me to do math wise. What is the desired outcome? Do I add 10 or subtract 2? Does it want a small number for a result or a large number? Is there no reference for learning this?

The desired outcome is kind of irrelevant. For each blank, there’s only really one option that would not throw a syntax error. Take the first one ___(myVar___10). You can only fit one in the first blank, and only a few others in the second blank.

I’m totally lost now…the outcome is irrelevant but there is only one option that won’t throw an error? I kept putting different things in there and eventually got passed it but I have no idea what I did or why it’s right. Where is this covered in the tutorial?

These things were covered in the tutorial, but you may have missed them. Basically, you had to print the result of various arithmetic operations. There are only certain ways of subtracting 5 from a variable, and printing it, so you had to fill in the gaps accordingly.

The first one:

console.log//because this is the only thing that will print the result

The second one:

+ //this is an arithmetic operation, and it works in this scenario:
//e.g: myVar // 10 just makes 10 a comment, '+' is a string, and the rest don't fit.

The third one:

myVar-5//this is the only one that performs a complete operation
//therefore, it must be here

The fourth one:

* 2//this is because this is an operation (* 2), but 
//not the complete thing (it is missing myVar, which is provided)

I hope this helps!


Let’s see.

Ok, take a look at your options, and just like @codeneutrino said, look for the one option that wouldn’t throw a syntax error if you put it in that blank.

For example, in console.log(_____);, you wouldn’t put console.log, since console.log(console.log); doesn’t make any sense. console.log(**); wouldn’t make any sense either. But what about console.log(myVar - 5);? That’s a totally correct statement.

And just like that, there is only 1 correct answer to fill in each blank and it will all make sense automatically.

I see… I remember those 4 but I don’t know what to do with them except the exercises in the tutorials. I don’t know what anything in the comments means. I only got thru the lessons because the instructions told me what to do.

I’m sorry I really don’t get this…If the goal is to not throw a syntax error (i still don;t know what this is) why does it ask to do a math problem? I just guessed the answer on the quiz i don’t understand how any of these options relate to += -= /= or whatever in the examples.

It’s okay, don’t worry.
Just like the english language has its own syntax rules, so do programming languages. A syntax error is when you write code that doesn’t really make sense and “confuses the computer”. Therefore the computer doesn’t know what to do and throws a syntax error.

So I think we can agree that no matter what kind of code we’re writing, we wanna keep it free of syntax errors :wink:
It is asking you to do a math problem, so you’re gonna have to use the operators taught in the lessons. You just have to make sure you’re writing code that makes sense for the computer. And, again, there is only 1 answer for each blank space that will let you write code that makes sense.

1 Like

I think all my code is errors, I can only do it if the instructions say what to do. I don’t know how to ‘speak’ javaScript i guess. I remember the operators in the lesson but it only showed a simple way to use them, I can only follow simple instructions at best.

Ufff….alright, look. I think this is all coming down to the basics of coding then. Don’t call yourself dumb! I struggled A LOT when I was trying to learn to code too, but thank God I had a good and patient teacher who made everything clear for me.

1 Like

Thank you for sharing your experience, Maybe I can find a teacher. I’m not sure what to do that at this point, even the basic courses for i’ve repeated over and over doesn’t make sense.