diff --git a/docs/javascript/all-about-variables/hoisting.md b/docs/javascript/all-about-variables/hoisting.md
index 6ec21e7e7..2e3523949 100644
--- a/docs/javascript/all-about-variables/hoisting.md
+++ b/docs/javascript/all-about-variables/hoisting.md
@@ -9,6 +9,8 @@ description: Learn about hoisting in JavaScript and how it affects variable decl
+
+
Hoisting is a unique feature of JavaScript that allows you to access variables and functions before they are declared in your code. This behavior can be surprising if you're not familiar with it, so understanding how hoisting works is essential for writing reliable JavaScript code.
In this tutorial, we'll explore what hoisting is, how it works in JavaScript, and how it affects variable declarations and function definitions.
@@ -19,6 +21,10 @@ Hoisting is a JavaScript mechanism where variable and function declarations are
It's important to note that only the declarations are hoisted, not the initializations. This means that the variable or function is available for use, but its value is `undefined` until the assignment is encountered in the code.
+
+
+
+
## How Does Hoisting Work?
### Hoisting with Variables
@@ -101,6 +107,10 @@ var sayHello = function () {
In this example, the variable `sayHello` is hoisted to the top of the scope, but the function assignment is not. Trying to call `sayHello` before the function assignment results in a `TypeError`.
+
+
+
+
### Summary of Hoisting Behavior
Here's a summary of how hoisting works in JavaScript:
diff --git a/docs/javascript/all-about-variables/variable-declarations.md b/docs/javascript/all-about-variables/variable-declarations.md
index 6f3247564..e6f3df835 100644
--- a/docs/javascript/all-about-variables/variable-declarations.md
+++ b/docs/javascript/all-about-variables/variable-declarations.md
@@ -9,6 +9,8 @@ description: Learn how to declare variables in JavaScript using the var, let, an
+
+
Variables are an essential part of any programming language, allowing you to store and manipulate data in your code. In JavaScript, variables are declared using the `var`, `let`, or `const` keywords. Each of these keywords has its own characteristics and best practices for usage. In this tutorial, we'll explore how to declare variables in JavaScript and discuss the differences between `var`, `let`, and `const`.
## What Are Variables?
@@ -43,6 +45,10 @@ In this example:
Now that you understand the concept of variables, let's explore how to declare them using the `var`, `let`, and `const` keywords.
+
+
+
+
## Declaring Variables with `var`, `let`, and `const`
In JavaScript, you can declare variables using the `var`, `let`, or `const` keywords. Each keyword has its own scope, hoisting behavior, and mutability characteristics. Let's examine the differences between `var`, `let`, and `const` and when to use each one.
@@ -151,6 +157,10 @@ PI = 3.14; // Error: Assignment to constant variable.
- **Imagination:** Imagine `const` as a stone tablet with an inscription that cannot be changed once it's been carved. It's a constant reminder of the value it holds.
+
+
+
+
## When to Use `var`, `let`, or `const`?
Here are some guidelines on when to use `var`, `let`, or `const` in your JavaScript code:
diff --git a/docs/javascript/all-about-variables/variable-naming-rules.md b/docs/javascript/all-about-variables/variable-naming-rules.md
index 5362381a1..e1cfa36b5 100644
--- a/docs/javascript/all-about-variables/variable-naming-rules.md
+++ b/docs/javascript/all-about-variables/variable-naming-rules.md
@@ -9,6 +9,8 @@ description: Learn about the rules and best practices for naming variables in Ja
+
+
When writing JavaScript code, it's essential to follow consistent naming conventions for variables to improve code readability and maintainability. Variable names should be descriptive, meaningful, and follow certain rules to ensure clarity and avoid conflicts.
In this tutorial, we'll cover the essential rules for naming variables in JavaScript, along with examples and tips to help you avoid common mistakes.
@@ -40,6 +42,10 @@ Choosing meaningful and descriptive variable names is crucial for writing clean
By following the rules and best practices for naming variables, you can write better code that is easier to maintain, understand, and share with others.
+
+
+
+
## Rules for Naming Variables
When naming variables in JavaScript, you need to follow certain rules and conventions to ensure consistency and readability. Here are the essential rules for naming variables:
@@ -78,6 +84,10 @@ let _count = 42;
let $discountRate = 0.1;
```
+
+
+
+
### 3. Variable Names Are Case-Sensitive
JavaScript variable names are case-sensitive, meaning that `name`, `Name`, and `NAME` are considered different variables. It's essential to be consistent with the casing of variable names to avoid confusion and errors in your code.
@@ -137,6 +147,10 @@ for (let i = 0; i < 10; i++) {
}
```
+
+
+
+
### 7. Use CamelCase for Multi-Word Variable Names
When a variable name consists of multiple words, it's common to use CamelCase to improve readability. In CamelCase, the first word is lowercase, and subsequent words are capitalized. This convention makes variable names easier to read and understand.
@@ -203,6 +217,10 @@ let g_userName = "Alice";
By following these rules and best practices for naming variables in JavaScript, you can write clean, readable, and maintainable code that is easy to understand and work with.
+
+
+
+
## Summary
Naming variables is a fundamental aspect of writing clean and maintainable JavaScript code. By following the rules and best practices outlined in this tutorial, you can improve the readability, consistency, and quality of your codebase. Here's a quick summary of the key points covered:
diff --git a/docs/javascript/all-about-variables/variable-scopes.md b/docs/javascript/all-about-variables/variable-scopes.md
index f7720be27..75049f9fc 100644
--- a/docs/javascript/all-about-variables/variable-scopes.md
+++ b/docs/javascript/all-about-variables/variable-scopes.md
@@ -9,6 +9,8 @@ description: Learn about the different scopes of variables in JavaScript.
+
+
Understanding variable scope in JavaScript is essential for writing effective and bug-free code. The scope of a variable determines where in your code a particular variable can be accessed or modified. Knowing how scopes work will help you prevent errors and make your code more predictable and maintainable.
In this tutorial, we'll explore the different types of scopes in JavaScript, how they work, and how you can use them to control the accessibility of your variables.
@@ -93,6 +95,10 @@ In the example above, `blockVar` is declared inside an `if` block, making it a b
Block scope helps you control the visibility and lifetime of variables within specific code blocks, reducing the chances of unintended side effects and making your code more predictable.
+
+
+
+
## Shadowing and Variable Scope
Shadowing occurs when a variable declared in an inner scope has the same name as a variable in an outer scope. In such cases, the inner variable "shadows" the outer variable, making the outer variable inaccessible within the inner scope.
diff --git a/docs/javascript/data-types/primitive-types/number.md b/docs/javascript/data-types/primitive-types/number.md
index ed5bda720..c94377476 100644
--- a/docs/javascript/data-types/primitive-types/number.md
+++ b/docs/javascript/data-types/primitive-types/number.md
@@ -9,6 +9,8 @@ description: Learn about the number data type in JavaScript, how to create numbe
+
+
Numbers are a crucial part of any programming language, and JavaScript is no exception. In JavaScript, numbers are used to perform calculations, manipulate data, and handle various operations. This tutorial will walk you through everything you need to know about numbers in JavaScript, from basic concepts to advanced usage.
## What Is a Number in JavaScript?
@@ -81,6 +83,10 @@ console.log(smallNumber); // Outputs: 0.000005
In the examples above, `5e6` represents `5` multiplied by `10` raised to the power of `6` (i.e., `5,000,000`), and `5e-6` represents `5` multiplied by `10` raised to the power of `-6` (i.e., `0.000005`).
+
+
+
+
## Number Precision
JavaScript numbers are precise up to 15 digits. Beyond this, precision may be lost, and the results of calculations might not be what you expect.
@@ -124,6 +130,10 @@ console.log(negativeInfinity); // Output: -Infinity
console.log(negativeInfinity - 1); // Output: -Infinity
```
+
+
+
+
### 3. NaN (Not-a-Number)
The `NaN` value represents a special "not-a-number" value in JavaScript. It is used to denote the result of an invalid mathematical operation, such as dividing zero by zero.
@@ -180,6 +190,10 @@ let number = parseInt("42");
console.log(number); // Output: 42
```
+
+
+
+
### 4. `parseFloat()`
The `parseFloat()` function parses a string and returns a floating-point number.
@@ -238,6 +252,10 @@ console.log(isFinite(42)); // Outputs: true
console.log(isFinite(Infinity)); // Outputs: false
```
+
+
+
+
### 9. `Number()`
The `Number()` function converts a value to a number.
@@ -297,6 +315,10 @@ let product = num1 * num2;
console.log(product); // Output: 30
```
+
+
+
+
### 4. Division (`/`)
The division operator (`/`) is used to divide one number by another.
diff --git a/docs/javascript/data-types/primitive-types/string.md b/docs/javascript/data-types/primitive-types/string.md
index 39e728e48..1a21d244a 100644
--- a/docs/javascript/data-types/primitive-types/string.md
+++ b/docs/javascript/data-types/primitive-types/string.md
@@ -9,6 +9,8 @@ description: Learn about the string data type in JavaScript, how to create strin
+
+
In JavaScript, a string is a sequence of characters enclosed within single or double quotes. Strings are used to represent text data and are one of the primitive data types in JavaScript.
## Creating Strings
@@ -51,6 +53,10 @@ let backticks = `Hello, World!`;
console.log(backticks); // Output: Hello, World!
```
+
+
+
+
## Common String Operations
Strings in JavaScript support various operations, such as concatenation, interpolation, and methods for manipulating string data. Here are some common string operations:
diff --git a/docs/javascript/data-types/primitive-types/undefined.md b/docs/javascript/data-types/primitive-types/undefined.md
index f48b0b90b..389ee67eb 100644
--- a/docs/javascript/data-types/primitive-types/undefined.md
+++ b/docs/javascript/data-types/primitive-types/undefined.md
@@ -9,6 +9,8 @@ description: Learn about the undefined data type in JavaScript, how to create un
+
+
In JavaScript, `undefined` is a primitive data type that represents an undefined value. When a variable is declared but not assigned a value, it is automatically assigned the value `undefined`.
## Creating Undefined Values
@@ -44,6 +46,10 @@ let undefinedValue;
console.log(typeof undefinedValue === "undefined"); // Output: true
```
+
+
+
+
## Common Operations with Undefined Values
### Assigning Undefined Values
diff --git a/docs/javascript/introduction-to-javascript/history-of-javascript.md b/docs/javascript/introduction-to-javascript/history-of-javascript.md
index 9f47a03bd..3f1b3746a 100644
--- a/docs/javascript/introduction-to-javascript/history-of-javascript.md
+++ b/docs/javascript/introduction-to-javascript/history-of-javascript.md
@@ -9,6 +9,8 @@ description: JavaScript has a rich history that dates back to the early days of
+
+
JavaScript, the language that powers the dynamic behavior of websites today, has an interesting history that dates back to the early days of the internet. It was created in just **10 days**, but its impact on the web has been profound and long-lasting. JavaScript has evolved significantly over the years, growing from a simple scripting language to a versatile and powerful programming language that is used by millions of developers worldwide. JavaScript was initially developed by **Brendan Eich** in 1995 while he was working at Netscape Communications Corporation.
### The Birth of JavaScript: A 10-Day Wonder
@@ -35,6 +37,10 @@ When JavaScript was first released, it was met with skepticism by some developer
- **2020:** JavaScript remains one of the most popular programming languages in the world, powering the majority of websites and web applications on the internet.
- **Future:** JavaScript continues to evolve, with new frameworks, libraries, and tools being developed to enhance its capabilities and simplify web development.
+
+
+
+
### JavaScript Today: A Ubiquitous Language
Today, JavaScript is used by millions of developers worldwide to build a wide range of applications, from simple websites to complex web applications. It has become an essential tool for front-end web development, enabling developers to create interactive, engaging user experiences. JavaScript is also used on the server-side, thanks to technologies like Node.js, allowing developers to build full-stack applications using a single language.
diff --git a/docs/javascript/introduction-to-javascript/how-to-run-javascript.md b/docs/javascript/introduction-to-javascript/how-to-run-javascript.md
index aa675b1d3..e19756a94 100644
--- a/docs/javascript/introduction-to-javascript/how-to-run-javascript.md
+++ b/docs/javascript/introduction-to-javascript/how-to-run-javascript.md
@@ -9,6 +9,8 @@ description: Learn how to run JavaScript code in the browser and in Node.js.
+
+
JavaScript is a versatile language that can be run in various environments. Whether you're creating interactive web pages, building server-side applications, or scripting automation tasks, JavaScript has you covered. In this chapter, we'll explore different ways to run JavaScript, from your browser to the server and beyond.
## 1. Running JavaScript in the Browser
@@ -177,6 +179,10 @@ These online editors provide a convenient way to write and run JavaScript code w
When using online editors, remember that your code runs in a sandboxed environment, so you may encounter limitations compared to running JavaScript locally on your machine.
:::
+
+
+
+
## 4. Running JavaScript in Integrated Development Environments (IDEs)
For more advanced JavaScript development, you can use Integrated Development Environments (IDEs) that provide powerful tools, debugging capabilities, and project management features. IDEs offer a comprehensive environment for writing, testing, and deploying JavaScript applications.
diff --git a/docs/javascript/introduction-to-javascript/javascript-versions.md b/docs/javascript/introduction-to-javascript/javascript-versions.md
index 98dd15641..24e103390 100644
--- a/docs/javascript/introduction-to-javascript/javascript-versions.md
+++ b/docs/javascript/introduction-to-javascript/javascript-versions.md
@@ -23,6 +23,8 @@ description: JavaScript has gone through numerous updates and improvements since
+
+
JavaScript has gone through numerous updates and improvements since its inception in 1995. These updates are officially known as ECMAScript (ES) versions, named after the standard maintained by ECMA International. Understanding these versions and their features is crucial for anyone looking to master JavaScript. Let's explore each significant version of JavaScript, what they introduced, and how they transformed the language.
### ECMAScript 1 (ES1) - The Beginning (1997)
@@ -44,6 +46,10 @@ The first official version of JavaScript was standardized as **ECMAScript 1 (ES1
ES3 was a significant milestone in JavaScript’s evolution, laying the foundation for modern web development practices. Many of the features introduced in ES3 are still widely used today.
+
+
+
+
### ECMAScript 4 (ES4) - The Unreleased Visionary
**ECMAScript 4 (ES4)** was an ambitious update that aimed to introduce many advanced features, including classes, modules, and strong typing. However, due to disagreements within the committee and concerns over the complexity of the proposed changes, ES4 was never officially released. Many of its ideas would later influence future versions of JavaScript.
@@ -141,6 +147,10 @@ ES5 was a significant step forward, making JavaScript more reliable, maintainabl
ES6 was a game changer, introducing many features that are now considered essential in modern JavaScript development.
+
+
+
+
### ECMAScript 2016 (ES7) - Simplicity and Power
**ECMAScript 2016 (ES7)**, released in 2016, was a smaller update but still added some valuable features:
@@ -243,6 +253,10 @@ ES8 continued the trend of making JavaScript more powerful and expressive, with
ES9 further refined JavaScript’s capabilities, making it easier to work with complex data structures and asynchronous operations.
+
+
+
+
### ECMAScript 2019 (ES10) - Refinements and Improvements
**ECMAScript 2019 (ES10)**, released in 2019, added useful refinements to JavaScript:
@@ -361,6 +375,10 @@ ES11 introduced features that improved code readability, maintainability, and pe
ES12 focused on quality-of-life improvements and developer productivity, making JavaScript code more concise and readable.
+
+
+
+
### ECMAScript 2022 (ES13) - Even More Enhancements
**ECMAScript 2022 (ES13**), released in 2022, continued the trend of enhancing JavaScript with new features that improve code readability, performance, and ease of use. The additions in ES13 are subtle but impactful, particularly for developers working with large, complex applications.
@@ -495,6 +513,10 @@ ES12 focused on quality-of-life improvements and developer productivity, making
This feature enhances regular expression handling by providing more detailed information about matched substrings.
+
+
+
+
### Conclusion
JavaScript has come a long way since its inception in 1995. Each new version of the language has introduced innovative features and improvements that have transformed the way developers write code. Understanding the evolution of JavaScript and the features introduced in each version is essential for mastering the language and staying up-to-date with the latest trends in web development. By learning about the different ECMAScript versions and their capabilities, you can enhance your skills as a JavaScript developer and build more robust, efficient, and maintainable applications.
diff --git a/docs/javascript/introduction-to-javascript/what-is-js.md b/docs/javascript/introduction-to-javascript/what-is-js.md
index 30d4f53e5..a30d2d8f0 100644
--- a/docs/javascript/introduction-to-javascript/what-is-js.md
+++ b/docs/javascript/introduction-to-javascript/what-is-js.md
@@ -9,6 +9,8 @@ description: JavaScript is a high-level, interpreted programming language that i
+
+
JavaScript is a powerful and versatile programming language that is widely used for front-end web development. It is a high-level, interpreted language that can be used to create interactive websites, web applications, and server-side applications. If you've ever interacted with a website—whether it's clicking a button, filling out a form, or watching content update dynamically—JavaScript was likely at work behind the scenes, making it all happen. JavaScript is the "magic" that brings web pages to life, allowing them to respond to user actions and create engaging experiences.
:::tip Imagine JavaScript as the "Magician" of Web Pages
@@ -53,6 +55,10 @@ JavaScript is one of the three core technologies of the web:
2. **CSS (Cascading Style Sheets):** CSS is the design or the skin of the web page. It styles the HTML elements, adding colors, layouts, and fonts to make the page visually appealing.
3. **JavaScript:** JavaScript is the brain that brings the page to life, allowing it to respond to user actions, perform calculations, manipulate content, and much more.
+
+
+
+
### Why is JavaScript Important?
- **Interactivity:** JavaScript allows users to interact with web pages in ways that were previously impossible. Hovering over menus, filling out forms, dragging and dropping items—all these actions are powered by JavaScript.