More JavaScript

·

1 min read

...More Snippets from follow along with Netninja

//Now to numbers:
let radius = 10;
const pie = 3.14;

console.log(radius, pie);

//math operators +, -, *, /, **, %
console.log(10/2);
let resultR = radius % 3; //takes a numer, divide by 3 and gives us the radius.
console.log(resultR); 
//Another operation
let resultRP = pie * radius**2;
console.log(resultRP);

// Order of Operation - BIDMAS
let resultB = 5 * (10-3)**2;
console.log(resultB)

//
let likes = 10;
likes = likes + 1;
//You can go likes++, a shorthandversion.
likes++; //But I got 12 now because I didnt comment the forst one out and then one got added.
likes--; //Now it also works for subtractiona and it was only after I subtracted that I got. 11..
console.log(likes);

....