Skip to content

Commit f22d3d3

Browse files
committed
Continuing Operator Learning
Continuing with learning about different kinds of operators in JS. Learned about Power Operator. Not certain what application use cases it has. Could be useful for tracking or creating relative exponential growth but in what way would that be useful to web development?
1 parent d7649d8 commit f22d3d3

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

01-Fundamentals-Part-1/starter/script.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,31 @@ const lastName = 'Allgeyer';
7070
console.log(firstName + lastName);
7171
*/
7272

73-
const ageJonas = 2037 - 1991;
7473

75-
console.log(ageJonas);
74+
// Math Operators
75+
const now = 2037;
76+
const ageJonas = now - 1991;
77+
const ageSarah = now - 2020;
78+
console.log(ageJonas, ageSarah);
79+
80+
console.log(ageJonas * 2, ageJonas / 10, 2 ** 3);
81+
// 2 ** 3 means 2 to the power of 3 = 2 * 2* 2 = 8
82+
83+
const firstName = 'Jonas';
84+
const lastName = 'Schmedtmann';
85+
console.log(firstName + ' ' + lastName);
86+
87+
// Assignment Operators
88+
let x = 10 + 5; // 15
89+
x += 10; // x = x + 10 = 25
90+
x *= 4; // x = x * 4 = 100
91+
x++; //x = x + 1
92+
x--; //x = x - 1
93+
x--;
94+
console.log(x);
95+
96+
// Comparison Operators
97+
console.log(ageJonas > ageSarah); // >, <, >=, <=
98+
console.log(ageSarah >= 18);
99+
100+
const isFullAge = ageSarah >= 18;

0 commit comments

Comments
 (0)