JavaScript Variables & Functions for Beginners ๐Ÿš€

์ž‘์„ฑ์ž

์นดํ…Œ๊ณ ๋ฆฌ:

โ† ํ”ผ๋“œ๋กœ
DEV Community ยท Narasimma Radhakrishnan ยท 2026-09-25 ๊ฐœ๋ฐœ(SW)

Narasimma Radhakrishnan

When I started learning JavaScript, the first two concepts I learned were variables and functions. They are the foundation of every JavaScript program.

What is a Variable? ๐Ÿ“ฆ

A variable is a container that stores data.

let name = “Narasimma”;
const age = 21;

console.log(name);
console.log(age);
let โ†’ Value can change
const โ†’ Value cannot be changed
What is a Function? โš™๏ธ

A function is a reusable block of code that performs a specific task.

function greet(name) {
return “Hello ” + name;
}

console.log(greet(“Student”));

Output:

Hello Student
Why Use Functions?

Instead of writing the same code many times, create one function and reuse it whenever needed.

์›๋ฌธ์—์„œ ๊ณ„์† โ†—

์ถ”์ถœ ๋ณธ๋ฌธ ยท ์ถœ์ฒ˜: dev.to ยท https://dev.to/narasimma/javascript-variables-functions-for-beginners-4d5h