Basic JavaScript - Compound Assignment With Augmented Subtraction

Tell us what’s happening: please give some feedback
Describe your issue in detail here.

Your code so far

let a = 11;
let b = 9;
let c = 3;

// Only change code below this line
a -= 6;
b -= -15;
c -= 2;

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic JavaScript - Compound Assignment With Augmented Subtraction

Link to the challenge:

Look carefully at the example given in the exercise’s description: you need to use it as a model. Also, there’s something that’s not supposed to be there in your code.

not getting it

a -= 6;
b -= -15;
c -= 7;```

We can come up with some generic example

If I say

stuff = stuff  - anotherStuff

it’s the same as

stuff -= anotherStuff

helps. got a and b. stuck on c for some reason.

a -= 6;
b -= 15;
c -= -3;

you have originally

c = c - 1;

so why are you using -3 here?

honestly IDK. I was trying to get it right. Math is not my strong suit. I am an artist by experience (and DNA :-))

1 Like

So, still stuck? or solved it?

thanks. I solved it. no idea how I did yet but started to figure it out

This is a negative number: -3

don’t think I am dumb yet I don’t get the importance of being a negative number

This step is not about math or negative/positive numbers actually.

Here they are just showing you some syntax, how things can be written in JavaScript

Try not think about math.

Think about this stuff as about abbreviations

I can write in the code:

a = a + 100;

it will work

but I can be a little bit more consice:

a += 100

ahhh. now that makes sense to me. thank you

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