...
JavaScript is a high-level scripting language used to make web pages interactive. It runs in the browser, allowing dynamic behavior like animations, pop-ups, data handling, and more.
✅ Runs on all modern browsers
✅ Used in front-end, back-end, mobile, and game development
✅ Works with HTML and CSS to create full web apps
✅ Core technology behind frameworks like React, Vue, and Angular
JavaScript works with:
HTML: Structures the content
CSS: Styles the content
JavaScript: Adds interactivity
It can be written directly in HTML using the <script> tag or included in separate .js files.
Variables store data. In modern JavaScript, use let and const instead of var.
let: Changeable
const: Cannot be reassigned
let age = 20;
const country = "Ethiopia";
Number: 25, 3.14
String: "Hello"
Boolean: true, false
Array: ["red", "green"]
Object: { name: "Maya", age: 22 }
Null / Undefined
Use conditions to control logic.
if (age >= 18) {
alert("You are an adult");
} else {
alert("You are a minor");
}
Loop through data:
for (let i = 0; i < 5; i++) {
console.log(i);
}
Functions let you reuse blocks of code.
function greet(name) {
return "Hello " + name;
}
greet("Christian"); // returns "Hello Christian"
Arrow functions (modern style):
const greet = (name) => "Hello " + name;
const fruits = ["apple", "banana", "orange"];
console.log(fruits[1]); // banana
Looping through arrays:
fruits.forEach((fruit) => console.log(fruit));
const student = {
name: "Maya",
age: 22,
course: "IT"
};
console.log(student.name); // Maya
JavaScript handles events like clicks, input changes, or form submissions.
<button onclick="sayHello()">Click Me</button>
<script>
function sayHello() {
alert("Welcome to Ardiland!");
}
</script>
Events include onclick, onchange, onsubmit, onmouseover, etc.
JavaScript can change the structure and style of your web page.
document.getElementById("title").innerText = "Welcome!";
You can also create, remove, and style HTML elements dynamically using DOM methods.
JavaScript has evolved. Newer versions include:
✅ let, const instead of var
✅ Arrow functions (()=>)
✅ Template literals: Hello ${name}
✅ Destructuring: const {name, age} = student;
✅ Spread/rest operators (...)
✅ Promises and async/await (for handling API calls)
JavaScript can communicate with external servers using APIs.
fetch("https://api.example.com/data")
.then(response => response.json())
.then(data => console.log(data));
✅ Used to fetch weather, news, or database data in real-time
✅ Common in front-end apps, dashboards, and mobile apps
✅ Always use const or let
✅ Keep code modular and reusable
✅ Avoid global variables
✅ Comment your code
✅ Test in browser console and use DevTools
✅ Learn debugging techniques for real-world problems
Websites (menus, forms, sliders)
Single Page Apps (React, Angular)
Mobile apps (React Native)
Server-side (Node.js)
Desktop apps (Electron.js)
Browser extensions and web games
Frontend Developer
Full Stack Developer
Mobile App Developer
UI Engineer
Web App Tester (with JS automation)
Freelancer / WordPress Customization