JavaScript Notes for Beginners (Simple + Easy Guide) ⚡
⚡ JavaScript Notes for Beginners (Simple + Easy Guide)
Hello everyone π
Welcome back to my blog!
In this post, you will learn JavaScript in a simple and easy way. These notes are perfect for beginners and BCA students for quick revision π
---
π What is JavaScript?
JavaScript is a programming language used to make web pages interactive.
π It works with HTML and CSS to create dynamic websites.
---
π’ Variables in JavaScript
Variables are used to store data.
let name = "Luna";
const age = 20;
var city = "Delhi";
---
π¦ Data Types
- String → "Hello"
- Number → 10
- Boolean → true / false
- Array → [1, 2, 3]
- Object → {name: "Luna"}
---
π Operators
- Arithmetic → + - * /
- Comparison → == === !=
- Logical → && || !
---
π Conditions
let age = 18;
if (age >= 18) {
console.log("Adult");
} else {
console.log("Minor");
}
---
π Loops
For Loop
for (let i = 0; i < 5; i++) {
console.log(i);
}
While Loop
let i = 0;
while (i < 5) {
console.log(i);
i++;
}
---
π§ Functions
Functions are blocks of code used to perform tasks.
function add(a, b) {
return a + b;
}
---
π±️ Events
Events are actions like click or hover.
button.onclick = function() {
alert("Button clicked!");
};
---
π DOM (Document Object Model)
DOM allows JavaScript to change HTML content.
document.getElementById("demo").innerHTML = "Hello World!";
---
⭐ Important Tip
Practice daily and try small programs π»
JavaScript becomes easy with practice!
---
π Conclusion
These were simple and easy JavaScript notes for beginners.
Save this post and revise anytime to improve your coding skills π
---
π Also read:
- HTML Notes
- CSS Notes
---
π If you found this helpful, save and share this post π
Follow for more coding notes π»
Comments
Post a Comment