Skip to content
  • SiteMap
  • Our Services
  • Frequently Asked Questions (FAQ)
  • Support
  • About Us

UpdateGadh

Update Your Skills.

  • Home
  • Projects
    •  Blockchain projects
    • Python Project
    • Data Science
    •  Ai projects
    • Machine Learning
    • PHP Project
    • React Projects
    • Java Project
    • SpringBoot
    • JSP Projects
    • Java Script Projects
    • Code Snippet
    • Free Projects
  • Tutorials
    • Ai
    • Machine Learning
    • Advance Python
    • Advance SQL
    • DBMS Tutorial
    • Data Analyst
    • Deep Learning Tutorial
    • Data Science
    • Nodejs Tutorial
  • Blog
  • Contact us
  • Toggle search form
30 Days Of JavaScript | DAY-3

DAY-4

Posted on July 20, 2023July 20, 2023 By Rishabh saini No Comments on DAY-4
JAVASCRIPT
  • JAVASCRIPT
  • JAVASCRIPT DAY -2
  • DAY-3
  • DAY-4
  • DAY-5
  • DAY-6

JavaScript Fundamentals: Day 4

          30 Days Of JavaScript

Greetings and welcome back to our thrilling ” 30 Days of Javascript” Today, on Day 4, we’re digging deep into the principles of JavaScript. You’re getting better at JavaScript every day, and today’s excursion looks to be nothing short of enchanting. 

We will summon the beauty of functions, harness the might of operators and expressions, discover the mysteries of conditional statements and loops, and explore this beautiful world. As we explore the fascinating world of JavaScript, get ready to wave your coding magic wand. 

30 Days Of JavaScript
30 Days Of JavaScript

Section 1: Operators and Expressions – The Language of Enchantment

JavaScript’s intriguing language is built around operators. They give you the ability to do amazing operations on variables and values. You open a door to a universe of possibilities with each operator.

Example Code:
let num1 = 5; 
let num2 = 3;
let sum = num1 + num2; // Active Voice: We add num1 and num2 to get the sum.
console.log(sum); // Output: 8
Here, we used the addition operator (+) to add num1 and num2, storing the result in the variable sum. The active voice empowers our code, clarifying each step of the enchantment.

 Youtube Video :

Section 2: Conditional Statements 

 In the mystical land of JavaScript, conditional statements guide your code’s destiny. They allow your spells to make choices based on conditions, taking your applications down different paths.
Example Code:
let hour = 15;
let greeting;
if (hour < 12) {
 greeting = "Good morning!"; // Active Voice: We set the greeting to "Good morning!"
} else {
 greeting = "Good afternoon!"; // Active Voice: We set the greeting to "Good afternoon!"
}
console.log(greeting); // Output: "Good afternoon!"
Here, we used an if statement to set the greeting based on the hour. If the hour is less than 12, the greeting is set to “Good morning,” otherwise, it’s set to “Good afternoon.“
30 Days Of JavaScript
30 Days Of JavaScript

Section 3: Loops – Unraveling Infinite Possibilities

Loops hold the key to unlocking infinite possibilities in JavaScript. They allow you to perform repetitive tasks and explore the vastness of your code.
Example Code:
for (let i = 1; i <= 5; i++) {
  console.log("Count: " + i); // Active Voice: We print the current count. }}} 
In this example, we used a for loop to print the count from 1 to 5. The active voice helps us understand each iteration’s purpose, creating clarity in our code.

Section 4: Functions – The Elegance of Reusable Magic

Functions are the embodiment of elegance in JavaScript. They encapsulate blocks of code, making your spells reusable and your codebase organized.
Example Code:
function greet(name) { 
return "Hello, " + name + "!"; // Active Voice: We return a personalized greeting. }
let greeting = greet("John");
console.log(greeting); // Output: "Hello, John!"
Here, we defined a function called greet that takes a name parameter and returns a personalized greeting. The active voice clarifies our function’s purpose, making it easier to comprehend.
 

Section 5: Variable Scope – The Boundaries of Your Magic Kingdom

Variable scope is the realm that governs the visibility and accessibility of variables in JavaScript. Understanding it is essential for controlling your magical creations.
Example Code:
javascriptCopy code
let globalSpell = "PWSC"; // Active Voice: We declare a global spell.
function castSpell() {
 let localSpell = "Updategadh"; // Active Voice: We declare a local spell inside the function.
console.log(globalSpell + " " + localSpell); // Output: "Abracadabra Alakazam"}
castSpell();
console.log(globalSpell); // Output: "Abracadabra"
console.log(localSpell); // Error: localSpell is not defined
In this example, the globalSpell is accessible throughout the entire code, while localSpell is only visible within the castSpell function. The active voice emphasizes each spell’s scope, bringing clarity to our incantations.
 

Section 6: JavaScript in the Real World – Enchanting Applications

The true magic of JavaScript shines when applied to the real world. Websites come alive with interactivity, captivating users with every click and scroll.
Example Code:
javascriptCopy code
const button = document.getElementById("myButton");
button.addEventListener("click", () => {
 alert("You clicked the button!"); // Active Voice: We show an alert when the button is clicked.});
In this example, JavaScript’s enchantment adds an event listener to a button element, displaying an alert when clicked. The active voice reinforces each step of this real-world magic.
Read more:https://updategadh.com/javascript/30-days-of-javascript-day-3/
Youtube Video :https://www.youtube.com/watch?v=_JPsTXAAUUo&list=PL92c0di50EKCw-5ugqKhp2rOkGiBslPHI&pp=iAQB
 30 Days Of JavaScript
Post Views: 751
JAVASCRIPT Tags:JavaScript

Post navigation

Previous Post: How to use ChatGPT: Everything you need to know
Next Post: How to Java web project configuration

More Related Articles

30 Days Of JavaScript : JAVASCRIPT JAVASCRIPT
How To Create a Parallax Scrolling Effect - Chrome Capture 2023 9 11 2 How To Create a Parallax Scrolling Effect JAVASCRIPT
famous-programming-languages DAY-5 JAVASCRIPT

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may also like

  1. JAVASCRIPT
  2. DAY-3
  3. DAY-5
  4. DAY-6
  5. Food Ordering App in React Node.js Free Source Code
  6. How to Start Learning Web Development in 30 Days: A Comprehensive Guide for Beginners

Most Viewed Posts

  1. Top Large Language Models in 2025
  2. Online Shopping System using PHP, MySQL with Free Source Code
  3. login form in php and mysql , Step-by-Step with Free Source Code
  4. Flipkart Clone using PHP And MYSQL Free Source Code
  5. News Portal Project in PHP and MySql Free Source Code
  6. User Login & Registration System Using PHP and MySQL Free Code
  7. Top 10 Final Year Project Ideas in Python
  8. Blog Site In PHP And MYSQL With Source Code || Best Project
  9. Online Bike Rental Management System Using PHP and MySQL
  10. E learning Website in php with Free source code
  • AI
  • ASP.NET
  • Blockchain
  • ChatCPT
  • code Snippets
  • Collage Projects
  • Data Science Project
  • Data Science Tutorial
  • DBMS Tutorial
  • Deep Learning Tutorial
  • Final Year Projects
  • Free Projects
  • How to
  • html
  • Interview Question
  • Java Notes
  • Java Project
  • Java Script Notes
  • JAVASCRIPT
  • Javascript Project
  • JSP JAVA(J2EE)
  • Machine Learning Project
  • Machine Learning Tutorial
  • MySQL Tutorial
  • Node.js Tutorial
  • PHP Project
  • Portfolio
  • Python
  • Python Interview Question
  • Python Projects
  • PythonFreeProject
  • React Free Project
  • React Projects
  • Spring boot
  • SQL Tutorial
  • TOP 10
  • Uncategorized
  • Agentic RAG AI System Using Python – Complete Final Year Project Guide
  • AI-Powered Online Examination System with Face Detection Using PHP & MySQL
  • Real-Time Medical Queue & Appointment System with Django
  • Online Examination System in PHP with Source Code
  • AI Chatbot for College and Hospital

Most Viewed Posts

  • Top Large Language Models in 2025 (8,630)
  • Online Shopping System using PHP, MySQL with Free Source Code (5,248)
  • login form in php and mysql , Step-by-Step with Free Source Code (4,911)

Copyright © 2026 UpdateGadh.

Powered by PressBook Green WordPress theme