FAQ: Variables - Mathematical Assignment Operators

2 posts were split to a new topic: Trying to understand w = w + 1 from a math perspective?

3 posts were split to a new topic: Any practical reason?

Hey guys i seem to have a little bit of trouble on number 3. and apparently i did all of the above even following the hint but it doesn’t seem to work can someone help me?
let multiplyMe = 32;
multiplyMe *= 11;
console.log(muliplyMe); // Output: 352

These lines are provided for us to test the outputs…

// These console.log() statements below will help you check the values of the variables.
// You do not need to edit these statements. 
console.log('The value of levelUp:', levelUp); 
console.log('The value of powerLevel:', powerLevel); 
console.log('The value of multiplyMe:', multiplyMe); 
console.log('The value of quarterMe:', quarterMe);

Hi,

Does

console.log(‘The value of levelUp:’, levelUp); &
console.log('The value of levelUp: ’ + levelUp);

work the same?
From the console both shows the same result.
Thanks.

11 posts were split to a new topic: How come a loop prints out the same variable value?

I cant find the value stored in ‘quarterMe’.I cant find where it says it

Is it just me but I can’t see where it lists the initials values for powerLevel, etc?! I can determine it through trial & error and the error messages but seems peculiar

1 Like

@robgit28 this will help if you’re still stuck, but this is info for all to know.
Initial values of variables levelUp, powerLevel, multiplyMe and quarterMe are not specified within the instructions of this exercise. These initial values should be listed in the following order within the instructions: levelUp having an initial value of 10, powerLevel having an initial value of 9001, multiplyMe having an initial value of 32, and quarterMe having an initial value of 1152.

Thanks for that, I probably didn’t read through it properly

I understood everything in part 5 of the ’ VARIABLES - Mathematical Assignment Operators’ exercise, but one thing that bugs me is the following part of the code you mentioned. Why is it that when we run the console there is space between ‘The value of quarterMe:’ and the output for quarterMe, even if we don’t have space included after the text inside the string?

console.log() takes a comma separated sequence of mixed types and streams it as character data to the display. Each comma is replaced with a space character.

why does this execruise have the console.log files entered at the bottom for you. was causing syntex errors at part 3 but not 2 or 1 when i tried to console.log my code was right just didn’t need to console log… id prefer it not do any work for me. can someone please explain why 1 and 2 didn’t error but 3 did
levelUp += 5;
console.log(levelup);// no error in syntex
powerLevel -= 100;
console.log(powerLevel);// no error
multiplyMe *= 11;
console.log(multiplyMe); // here is where i got the error

Is it a TypeError? It will be that if multiplyMe is not defined or is not a number.

well i dont really know as soon as the console.log(multiplyMe) was removed the error went away.sry not a very good explanation i have three conversations going on nobody will let me learn in this house.

Are these lines present at the top of the code?

let levelUp = 10;
let powerLevel = 9001;
let multiplyMe = 32;
let quarterMe = 1152;

Are these lines present at the bottom of the code?

// You do not need to edit these statements. 
console.log('The value of levelUp:', levelUp); 
console.log('The value of powerLevel:', powerLevel); 
console.log('The value of multiplyMe:', multiplyMe); 
console.log('The value of quarterMe:', quarterMe);

The code we write for steps 1, 2, 3 and 4 should appear on lines 7, 8, 9 and 10.

yes that’s the lesson lol i didn’t read all the compiler messages so i added the console.logs for each one myself.
1 and 2 worked just fine when i did but number 3 through a syntax error. im very new to coding and dont understand how the compiler uses’s the data . so my question was y 1 and 2 didn’t give the error but 3 did.
The code i put into my initial question is exactly how it was entered into the compiler. And thank you for your help


i don’t know if i am allowed to upload a screen capture so please forgive me if not but this is how it was done exactly 1 and 2 worked 3 does not.

i wish i had taken a screenshot initially. I just found an error in the screen capture i uploaded. but i think i just answered my own question. multiplyME capitalized e may be the reason for the original error but alas i cant remember what the original error was.

1 Like

Plus you do not need to do any logging. The exercise has that prepped and ready to go.