James McGrath

Quick tips, in-depth guides, and thoughts on the future of the web

What Is a Function Parameter?

🧪 Concept:

A parameter is a placeholder in a function — like a blank to fill in when you call it.

function greet(name) {
console.log("Hello, " + name + "!");
}

greet("Riley");

This outputs: Hello, Riley!
You passed in "Riley" to fill the name blank.

🧰 Why It Matters:

Parameters make your functions flexible. One function can handle all kinds of input — just pass in what you need.

🎉 Quick Challenge:

Write a function with a parameter for a favorite food:

function sayFavorite(food) {
console.log("I love " + food + "!");
}

sayFavorite("ramen");

🧠 Fun Analogy:

A parameter is like a fill-in-the-blank in a greeting card. “Dear ___” becomes anything you want.

📚 Further Reading:

MDN Docs – Functions
W3Schools – JavaScript Function Parameters

Subscribe to my feed to follow along. One tip a day, no overwhelm.

What Is an If Statement?

One response to “What Is a Function Parameter?”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.