Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/javascript/all-about-variables/hoisting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: Learn about hoisting in JavaScript and how it affects variable decl

<AdsComponent />

<br />

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.
Expand All @@ -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.

<AdsComponent />

<br />

## How Does Hoisting Work?

### Hoisting with Variables
Expand Down Expand Up @@ -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`.

<AdsComponent />

<br />

### Summary of Hoisting Behavior

Here's a summary of how hoisting works in JavaScript:
Expand Down
10 changes: 10 additions & 0 deletions docs/javascript/all-about-variables/variable-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: Learn how to declare variables in JavaScript using the var, let, an

<AdsComponent />

<br />

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?
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

## 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.
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

## When to Use `var`, `let`, or `const`?

Here are some guidelines on when to use `var`, `let`, or `const` in your JavaScript code:
Expand Down
18 changes: 18 additions & 0 deletions docs/javascript/all-about-variables/variable-naming-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: Learn about the rules and best practices for naming variables in Ja

<AdsComponent />

<br />

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.
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

## 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:
Expand Down Expand Up @@ -78,6 +84,10 @@ let _count = 42;
let $discountRate = 0.1;
```

<AdsComponent />

<br />

### 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.
Expand Down Expand Up @@ -137,6 +147,10 @@ for (let i = 0; i < 10; i++) {
}
```

<AdsComponent />

<br />

### 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.
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

## 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:
Expand Down
6 changes: 6 additions & 0 deletions docs/javascript/all-about-variables/variable-scopes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: Learn about the different scopes of variables in JavaScript.

<AdsComponent />

<br />

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.
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

## 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.
Expand Down
22 changes: 22 additions & 0 deletions docs/javascript/data-types/primitive-types/number.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: Learn about the number data type in JavaScript, how to create numbe

<AdsComponent />

<br />

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?
Expand Down Expand Up @@ -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`).

<AdsComponent />

<br />

## 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.
Expand Down Expand Up @@ -124,6 +130,10 @@ console.log(negativeInfinity); // Output: -Infinity
console.log(negativeInfinity - 1); // Output: -Infinity
```

<AdsComponent />

<br />

### 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.
Expand Down Expand Up @@ -180,6 +190,10 @@ let number = parseInt("42");
console.log(number); // Output: 42
```

<AdsComponent />

<br />

### 4. `parseFloat()`

The `parseFloat()` function parses a string and returns a floating-point number.
Expand Down Expand Up @@ -238,6 +252,10 @@ console.log(isFinite(42)); // Outputs: true
console.log(isFinite(Infinity)); // Outputs: false
```

<AdsComponent />

<br />

### 9. `Number()`

The `Number()` function converts a value to a number.
Expand Down Expand Up @@ -297,6 +315,10 @@ let product = num1 * num2;
console.log(product); // Output: 30
```

<AdsComponent />

<br />

### 4. Division (`/`)

The division operator (`/`) is used to divide one number by another.
Expand Down
6 changes: 6 additions & 0 deletions docs/javascript/data-types/primitive-types/string.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: Learn about the string data type in JavaScript, how to create strin

<AdsComponent />

<br />

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
Expand Down Expand Up @@ -51,6 +53,10 @@ let backticks = `Hello, World!`;
console.log(backticks); // Output: Hello, World!
```

<AdsComponent />

<br />

## 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:
Expand Down
6 changes: 6 additions & 0 deletions docs/javascript/data-types/primitive-types/undefined.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: Learn about the undefined data type in JavaScript, how to create un

<AdsComponent />

<br />

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
Expand Down Expand Up @@ -44,6 +46,10 @@ let undefinedValue;
console.log(typeof undefinedValue === "undefined"); // Output: true
```

<AdsComponent />

<br />

## Common Operations with Undefined Values

### Assigning Undefined Values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: JavaScript has a rich history that dates back to the early days of

<AdsComponent />

<br />

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
Expand All @@ -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.

<AdsComponent />

<br />

### 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: Learn how to run JavaScript code in the browser and in Node.js.

<AdsComponent />

<br />

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
Expand Down Expand Up @@ -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.
:::

<AdsComponent />

<br />

## 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ description: JavaScript has gone through numerous updates and improvements since

<AdsComponent />

<br />

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)
Expand All @@ -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.

<AdsComponent />

<br />

### 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.
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

### ECMAScript 2016 (ES7) - Simplicity and Power

**ECMAScript 2016 (ES7)**, released in 2016, was a smaller update but still added some valuable features:
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

### ECMAScript 2019 (ES10) - Refinements and Improvements

**ECMAScript 2019 (ES10)**, released in 2019, added useful refinements to JavaScript:
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

### 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.
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

### 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.
6 changes: 6 additions & 0 deletions docs/javascript/introduction-to-javascript/what-is-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ description: JavaScript is a high-level, interpreted programming language that i

<AdsComponent />

<br />

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
Expand Down Expand Up @@ -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.

<AdsComponent />

<br />

### 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.
Expand Down
Loading