JavaScript for Beginner
4 min read 👋

JavaScript for Beginner

Lwin Moe Paing

written by

Lwin Moe Paing

Founder of Erudite

Updated on Feb 18, 2026

JavaScript is the language of the web. Every website you interact with uses it. Let's learn the fundamentals step by step.

Variables and Data Types

JavaScript has three ways to declare variables: let, const, and the older var. Use const for values that don't change, and let when they do.

Step 1 / 3

Declare a constant

const name = "Erudite";
Use ← → keys
Tip

Always prefer const over let. Only use let when you know the value will change later.

Functions

Functions are reusable blocks of code. JavaScript offers multiple ways to write them.

Step 1 / 4

Define an empty function

function greet() {
}
Use ← → keys

You can also write functions using arrow syntax:

Arrow function
const greet = (name) => `Hello, ${name}!`;
Info

Arrow functions are shorter but behave differently with this. For now, use whichever feels more readable.

Arrays

Arrays store ordered lists of values. JavaScript provides powerful methods to work with them.

Step 1 / 4

Create an array

const fruits = ["apple", "banana", "cherry"];
Use ← → keys

Objects

Objects store data as key-value pairs. They are the building blocks of almost everything in JavaScript.

Step 1 / 4

Create a simple object

const user = {
name: "Lwin",
age: 25,
};
Use ← → keys

Async JavaScript

Real-world apps need to fetch data, read files, or wait for user actions. JavaScript handles this with async/await.

Step 1 / 4

Define an async function

async function fetchUser() {
}
Use ← → keys
Warning

Always wrap await calls in try/catch. Network requests can fail, and unhandled errors will crash your application.

Conclusion

You've just covered the core building blocks of JavaScript — variables, functions, arrays, objects, and async patterns. These fundamentals appear in every JavaScript project, whether you're building a website, a server, or a mobile app.

The best way to learn is by building. Pick a small project and start writing code.