Category: Javascript
-
30 Practice Questions (JavaScript)
🔹 🟢 Easy Level (1–10) 🔹 🟡 Medium Level (11–20) *************** 🔹 🔴 Hard Level (21–30) 112123123412345 *************** 🎯 Bonus Challenge (for smart students) 👉 FizzBuzz (very popular interview question)
-
3️⃣ Control Statements (Decision Making)
Control statements help your program make decisions based on conditions. ✅ 1. if Statement Runs code only if condition is true 👉 If condition is true → code runs👉 If false → nothing happens ✅ 2. if…else Runs one block if true, another if false ✅ 3. else if Used when checking multiple conditions ✅…
-
2️⃣ JavaScript Basics
🔹 1. Variables Variables are used to store data. ✅ var ✅ let ✅ const 🔹 2. Data Types 📌 String Text values 📌 Number Numbers (integer or decimal) 📌 Boolean True or False 📌 Undefined Variable declared but not assigned 📌 Null Empty value (intentionally) 📌 Object Collection of key-value pairs 📌 Array List…
-
1️⃣ Introduction to JavaScript
✅ What is JavaScript? JavaScript is a programming language used to make websites interactive and dynamic. 👉 Without JavaScript: 👉 With JavaScript: 📌 Example: 📜 History of JavaScript 👉 Important: 📈 Today: ⚔️ JavaScript vs HTML vs CSS Technology Purpose HTML Structure (Skeleton) CSS Design (Styling) JavaScript Behavior (Brain) 👉 Example: 🌐 How JavaScript Works…
-
Password Strength Tester
Password Strength Tester Strength: Weak Introduction to Cybersecurity Cybersecurity is the practice of protecting systems, networks, and data from digital attacks. These attacks are usually aimed at accessing, changing, or destroying sensitive information. Confidentiality: Protects data from unauthorized access. Integrity: Keeps information accurate and unchanged. Availability: Ensures data and systems are accessible when needed. 2.…
-
How to Download the current HTML as a file using JavaScript
<div class=”text-right mt-4″> <button id=”downloadBtn” class=”btn btn-outline-secondary”>Download HTML</button> </div>
-
add underscore between words javascript
To add underscores between words in a JavaScript string, effectively replacing spaces with underscores, you can use the replace() or replaceAll() methods, or a combination of split() and join(). 1. Using replace() with a Regular Expression: This method uses a regular expression to find all occurrences of spaces and replaces them with an underscore. The /g flag ensures a global replacement (all occurrences, not just the first).…
-
How can create user preferences in JavaScript by storing the choice when the user clicks something, and then reloading it whenever the page is opened again
You can create user preferences in JavaScript by storing the choice when the user clicks something, and then reloading it whenever the page is opened again. The usual way is to use localStorage or cookies. Here’s a step-by-step example: Example: Save User Theme Preference (Dark/Light Mode) HTML JavaScript CSS How It Works
