History

collapsed:: true - How: - Developed by Brendan Eich in 1995 at Netscape. - Initially created in just 10 days as a client-side scripting language for web browsers. - - Who: - Brendan Eich, co-founder of Mozilla and creator of JavaScript. - Netscape Communications Corporation. - - Why: - To enable dynamic and interactive web content. - To complement HTML and CSS for enhanced web development.

  • Introduction

    • Advantages :

      • Asynchronous Programming (Promises, Async/Await).
      • JavaScript Design Patterns (Module, Singleton, Observer).
      • Prototypal Inheritance and ES6 Classes.
      • TypeScript and Typed JavaScript.
    • Disadvantages :

      • Browser inconsistencies in older versions.
      • Lack of strong typing can lead to runtime errors.
      • Complexities in large-scale application development.
  • Notes

    • You can Direcly create page by write {filename}.js
    • console.log("msg") - Print that msg
    • console.warn('hello %s', 'Cheekbone') - The %s is a placeholder for a string, allowing you to format the message with additional variables.
    • console.error(new Error(‘Oops!‘)) - console.error(new Error(‘Oops!’));
    • In Html use <script {You can Give link path or } > write Here this tag for write js
    • variables Types

      • Primitive Types:

        • String: Represents text (e.g., "Hello, world!").
        • Number: Represents numeric values (e.g., 42, 3.14).
        • BigInt: Represents integers of arbitrary precision (e.g., 12345678901245678901234567890n).
        • Boolean: Represents a logical entity that can be either true or false.
        • Undefined: A variable that has been declared but has not been assigned a value(e.g., let a;).
        • Null: Represents the intentional absence of any value (e.g., let b = null;).
        • Symbol: A unique and immutable primitive value often used as object property keys.
      • Object Types:

        • Object: A collection of key-value pairs (e.g., { name: "Alice", age: 25 }).
        • Array: A special type of object for storing ordered lists (e.g., [1, 2, 3]).
        • Function: A callable object that can be defined with the function keyword (e.g., function add(a, b) { return a + b; }).
        • Date: A built-in object for working with dates and times (e.g., new Date()).
        • RegExp: Regular expressions for pattern matching in strings (e.g., /abc/).
    • Scope Types

      • Global Scope: Variables declared outside any function or block. Accessible anywhere in the code.

      • Function Scope: Variables declared inside a function using var. Accessible only within that function.

      • Block Scope: Variables declared with let or const within a block (e.g., inside {} braces). Accessible only within that block.

      • Extra Explain

        • let vs var

        • Loops with closures

    • Operators

      • Arithmetic Operators

        • + (Addition)
        • - (Subtraction)
        • * (Multiplication)
        • / (Division)
        • % (Modulus)
        • ** (Exponentiation)
      • Assignment Operators

        • = (Assign)
        • += (Add and assign)
        • -= (Subtract and assign)
        • *= (Multiply and assign)
        • /= (Divide and assign)
        • %= (Modulus and assign)
        • **= (Exponentiation and assign)
      • Comparison Operators

        • == (Equal to)
        • === (Strict equal to)
        • != (Not equal to)
        • !== (Strict not equal to)
        • > (Greater than)
        • < (Less than)
        • >= (Greater than or equal to)
        • <= (Less than or equal to)
      • Logical Operators

        • && (Logical AND)
        • || (Logical OR)
        • ! (Logical NOT)
      • Bitwise Operators

        • & (Bitwise AND)
        • | (Bitwise OR)
        • ^ (Bitwise XOR)
        • ~ (Bitwise NOT)
        • << (Left shift)
        • >> (Right shift)
        • >>> (Unsigned right shift)
      • Unary Operators

        • ++ (Increment)
        • -- (Decrement)
        • + (Unary plus)
        • - (Unary negation)
        • typeof (Returns the type of a variable)
        • void (Evaluates an expression and returns undefined)
        • delete (Deletes a property from an object)
      • Ternary Operator

        • A shorthand for if...else statements.
        • condition ? exprIfTrue : exprIfFalse
      • Comma Operator

        • Allows multiple expressions to be evaluated, returning the value of the last expression.
        • expr1, expr2, expr3
      • Spread and Rest Operators

        • Spread Operator: ... (expands an iterable into individual elements)
        • Example: let arr = [1, 2]; let newArr = [...arr, 3];
        • Rest Operator: ... (gathers multiple elements into an array)
        • Example: function myFunc(...args) { /* args is an array */ }
      • Instanceof Operator

        • Tests whether an object is an instance of a specific constructor.
        • object instanceof Constructor
      • In Operator

        • Checks if a property exists in an object.
        • property in object
    • JavaScript Conditionals

      • if Statement

      • Ternary Operator

      • else if

      • switch Statement

      • vs =

    • JavaScript Functions

      • Functions

      • Anonymous Functions

      • return Keyword

      • Calling Functions

      • Function Expressions

      • Function Parameters

      • Function Declaration

      • Arrow Functions (ES6)

    • JavaScript Arrays

      • Mutable chart

      • Arrays

      • Property .length

      • Index

      • Method .push()

      • Method .pop()

      • Method .shift()

      • Method .unshift()

      • Method .concat()

      • More Methods

    • JavaScript Loops

      • While Loop

      • Reverse Loop

      • Do…While Statement

      • For Loop

      • Looping Through Arrays

      • Break

      • Continue

      • Nested

      • for…in loop

      • for…of loop

    • JavaScript Iterators

      • Functions Assigned to Variables

      • Callback Functions

      • Array Method .reduce()

      • Array Method .map()

      • Array Method .forEach()

      • Array Method .filter()

    • JavaScript Objects

      • Accessing Properties

      • Naming Properties

      • Non-existent properties

      • Mutable

      • Assignment shorthand syntax

      • Delete operator

      • Objects as arguments

      • Shorthand object creation

      • this Keyword

      • Factory functions

      • Methods

      • Getters and setters

    • JavaScript Classes

      • Static Methods

      • Class

      • Class Constructor

      • Class Methods

      • extends

    • JavaScript Modules

      • Export

      • Import

      • Export Module

      • Require Module

      • JavaScript Promises

        • Promise states

        • Executor function

        • setTimeout()

        • .then() method

        • .catch() method

        • Promise.all()

        • Avoiding nested Promise and .then()

        • Creating

        • Chaining multiple .then()

        • Fake http Request with Promise

    • JavaScript Async-Await

      • Asynchronous

      • Resolving Promises

      • Async Await Promises

      • Error Handling

      • Aysnc await operator

    • JavaScript Requests

      • JSON

      • XMLHttpRequest

      • GET

      • POST

      • fetch api

      • JSON Formatted

      • promise url parameter fetch api

      • Fetch API Function

      • async await syntax

  • Library & Frameworks

    • React js - This is Use Full for Front-end single page web application
    • Node Js - JavaScript runtime built on Chrome’s V8 engine for building fast and scalable server-side applications.
    • jQuery - Simplifies DOM manipulation.
    • Lodash - Utility library for JavaScript.
    • Angular - Platform for building mobile and desktop web applications.
    • Vue.js - Progressive framework for building user interfaces.
  • More Learn