Learning to Code: Day 38 — Basic JavaScript Part 3

Hello everyone, I’m starting night shifts now at work because of COVD-19 so these coding days have been a bit sparse of late, however I am learning at my pace, not that of someone else, so this works for me, to code in the evening a couple hours before work.. Here we go, back into ye ole’ JavaScript! We’ll be parcing through a couple more math terms today. Thanks to FreeCodeCamp for the lessons.

Finding the Remainder in JS

48 % 2 = 0 (Even)

17 % 2 = 1(Odd)

Compound Assignment with Augmented Maths


var myVar =1;

myVar += 5;

We are defining the variable “myVar” and to be equal to 1, then we add 5 to that variable, and perform the following to give the result which will equal 6:



var myVar = 1;

myVar -= 5;


This will result in -4.



Declaring String Variables

Escaping Quotations in Strings

var simpleString = “Then he looked, \“I have had a great day today\”, said John.”;

Note: It’s good practise to use double quotes ( “ ” )for a string and not single quotes ( ‘ ’ ) as you may need to use the single quotes in words like “it’s” for example. If you do so, always remember that backslash: “it\’s”.

Aaaaaand let’s call it there for now. Looking forward to next time. Cheers guys!

Step by step, learning to code with FreeCodeCamp