Hello Dev Community! ๐
It is Day 9 of my journey toward the MERN stack! Today, I followed Lecture 2 of Apna College's JavaScript course, which transitions from storing data to actually manipulating it and making decisions.
Yesterday was about variables; today was about giving the code a "brain" to choose different paths based on conditions.
๐ง Key Learnings From JS Lecture 2
Here is the exact breakdown of the concepts I cracked today:
1. JavaScript Operators
Before making decisions, code needs to compare values. I learned about:
-
Arithmetic Operators:
+,-,*,/, and%(Modulusโgreat for finding odd/even numbers). -
Assignment Operators:
=,+=,-=to update variable values quickly. -
Comparison Operators:
==(checks value) vs===(Strict Equality: checks both value AND data typeโa true senior dev practice!).
2. Conditional Statements (The Decision Makers)
I learned how to control the flow of my program using if, else if, and else blocks. The syntax is straightforward:
javascript
let mode = "dark";
let color;
if (mode === "dark") {
color = "black";
} else {
color = "white";
}
console.log(color);
Top comments (0)