Skip to main content

Featured

🔠 Day 8 — Strings & String Methods in JavaScript

🔠 Day 8 — Strings & String Methods in JavaScript Welcome to Day 8 🌟 — Today’s session is all about **Strings**, one of the most common data types in JavaScript. Strings represent text and allow you to store names, messages, or any sequence of characters. 💬 1️⃣ What is a String? A string is a sequence of characters written inside quotes. let name = "Rahul"; let greeting = 'Hello World'; let message = `Welcome ${name}!`; // Template literal 🧩 2️⃣ String Properties Strings behave like arrays — they have a .length property and can be accessed using index numbers. let text = "JavaScript"; console.log(text.length); // 10 console.log(text[0]); // J console.log(text[text.length - 1]); // t 🎨 3️⃣ Common String Methods toUpperCase() & toLowerCase() let city = "Hyderabad"; console.log(city.toUpperCase()); console.log(city.toLowerCase()); slice(start, end) let word = "JavaScript"; console.log(word.slice(0, 4)...

⚡ Day 1 — Introduction to JavaScript

⚡ Day 1 — Introduction to JavaScript

Welcome to Day 1 of your 45-Day JavaScript Journey! 🎉 JavaScript is the language that brings **life and interactivity** to the web. If HTML is the skeleton and CSS is the skin, then JavaScript is the **brain** that makes your webpage think and react. By the end of this course, you’ll be able to build full web applications, games, and interactive websites — all with pure JavaScript.

🌍 1️⃣ What is JavaScript?

JavaScript (JS) is a **programming language** used to make websites interactive. It runs directly in the **browser**, meaning users don’t need to install anything. It can also be used on the **server side** (using Node.js), making it one of the most versatile languages in the world.

🧠 2️⃣ Why Learn JavaScript?

  • ✅ It’s the core of front-end web development.
  • ✅ It powers frameworks like React, Angular, and Vue.
  • ✅ It’s also used for backend (Node.js) and mobile apps (React Native).
  • ✅ It’s beginner-friendly and highly in demand by companies.

⚙️ 3️⃣ How JavaScript Works

JavaScript runs in your web browser using a **JavaScript Engine** (like Chrome’s V8 engine). When you open a webpage, the browser reads HTML first, then loads and executes the JavaScript code line by line.

💻 4️⃣ Adding JavaScript to a Web Page

There are 3 main ways to add JavaScript:

  • Inline: Write inside an HTML tag using onclick
  • Internal: Inside a <script> tag in the HTML file
  • External: Link a separate JS file
<!DOCTYPE html>
<html>
<head>
  <title>JS Example</title>
</head>
<body>
  <h1>Welcome to JavaScript</h1>
  <button onclick="alert('Hello Rahul!')">Click Me</button>

  <script>
    console.log('Hello from Internal Script!');
  </script>
</body>
</html>

You can see results using Console in your browser (Right Click → Inspect → Console Tab).

🧩 5️⃣ console.log()

The console.log() function prints messages to the browser console. It’s mainly used for debugging.

console.log("Welcome to JavaScript");
console.log(10 + 5);
console.log("Radha" + " " + "Krishna");

🧮 6️⃣ JavaScript Features

  • Dynamic — no need for strict data types.
  • Interpreted — runs line-by-line.
  • Event-driven — responds to user interactions.
  • Object-oriented — supports reusable components.

🧠 7️⃣ Practice Task

  1. Create a webpage that displays a welcome message using alert().
  2. Write 3 console.log() statements for your name, age, and hobby.
  3. Use comments (//) to describe your code.

🎯 Summary

Today, you learned what JavaScript is, why it’s important, and how to run it. Tomorrow, we’ll dive into the basics — **variables, constants, and data types** — the building blocks of every JS program.

Comments