DEV Community

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

Posted on

#javascript #apnacollege #webdev #beginners

Hello Dev Community! 👋

It is officially Day 15 of my journey toward mastering the MERN stack! Today, I stepped into one of the most critical fundamentals of all programming paradigms by starting Lecture 5 of Apna College's JavaScript playlist with Shradha Didi: Functions.

Up until now, if I wanted to run a block of logic in different parts of my file, I had to rewrite or copy-paste it. Today, I learned how to package code into a clean, reusable machine.


🧠 Key Learnings From JS Lecture 5 (Functions)

I explored how JavaScript blocks together logic and how data flows inside and outside of a function:

1. Function Definition & Execution

A function is simply a block of code that performs a specific task and executes only when it is explicitly "called" or "invoked".

  • Definition Syntax: function myFunction() { // code }
  • Invocation Syntax: myFunction();

2. Parameters vs. Arguments

I learned how to pass dynamic data into my functions to make them flexible:

  • Parameters: The placeholder variables we define in the function declaration (e.g., function add(a, b)).
  • Arguments: The actual real values we pass into the function when calling it (e.g., add(5, 10)).

3. The return Keyword

A major takeaway today was understanding that a function can send a value back to the place where it was called using return. Crucially, I learned that once a return statement executes, the function stops immediately, and any code written after it becomes unreachable.


🛠️ What I Actually Code / Practiced

I spent my practice session solving the algorithmic functional challenges from the lecture:

  • The Sum & Product Functions: Built basic math functions that take parameters and safely return values.
  • The Vowels Counter Challenge: This was the main highlight! I wrote a function that takes a string as an argument and uses a loop to count and return the exact number of vowels (a, e, i, o, u) present inside that text block.

Seeing a function take a raw text input, scan it, and return a clean numerical count felt like a huge leap in my programming logic!


🎯 My Goal for Tomorrow (Day 16 / Lecture 5 Part 2)

Tomorrow, I will be jumping into modern JavaScript syntax within Lecture 5:

  • Mastering Arrow Functions (const myFunc = () => {}) which are heavily used in modern frameworks like React.
  • Learning about Array Callback Methods like .forEach().

💬 Let's Connect!

To the Apna College community: How did you optimize your Vowels Counter function today? To seniors: Do you still use traditional function declarations in your codebases, or have you shifted 100% to Arrow Functions?

My Lecture 5 function scripts are pushed to GitHub!
[Links in the Comments]

Keep learning, keep building! 🚀

Top comments (0)