DEV Community

Cover image for #javascript #apnacollege #webdev #beginners
Ali Hamza
Ali Hamza

Posted on

#javascript #apnacollege #webdev #beginners

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);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)