Free · 269 Topics · No Signup
JavaScript Notes
The language of the web — syntax, DOM, events, async and modern JavaScript — written by CodingNow 2.0's mentors. Free to read, structured to actually help you learn.
JavaScript notes by CodingNow 2.0 cover 269 topics — from js home to js jsonp — each explained with short definitions, syntax and runnable code examples. They are 100% free, need no signup, and work as quick revision for college exams, JavaScript interviews and CodingNow 2.0's mentor-led JavaScript course in Pitampura, Delhi.
No notes found. Try a different search term, or browse all JavaScript notes.
JS Tutorial
157 of 157 topics publishedJS Home
! JS (https://www.w3schools.com/js/img_javascript_480.jpg)
JS Introduction
JavaScript is the programming language of the web.
JS Where To
In HTML, JavaScript code is inserted between <script and </script tags.
JS Output
JavaScript can "display" data in different ways:
JS Syntax
Syntax are the rules how programs must be constructed:
JS Statements
A computer program is a list of "instructions" to be "executed" by a computer.
JS Comments
JavaScript comments can be used to explain JavaScript code, and to make it more readable.
JS Variables
JavaScript variables are containers for data.
JS Let
The let keyword was introduced in ES6 (2015)
JS Const
The const keyword was introduced in ES6 (2015)
JS Types
A JavaScript variable can hold 8 types of data:
JS Operators
Operators are for Mathematical and Logical Computations
JS Arithmetic
Arithmetic operators perform arithmetic on numbers (literals or variables).
JS Assignment
Assignment operators assign values to JavaScript variables.
JS Comparisons
Comparison operators are used to compare two values.
JS Conditional
Conditional Statements allow us to perform different actions for different conditions.
JS If Conditions
Use the JavaScript if statement to execute a block of code when a condition is true.
JS If Else
Use the else statement to specify a block of code to be executed if a condition is false .
JS Ternary
let text = (age < 18) ? "Minor" : "Adult";
JS Switch
Based on a condition, switch selects one or more code blocks to be executed.
JS Booleans
In JavaScript, a Boolean is a primitive data type that can only have one of two values:
JS Logical
Logical operators are used to combine boolean expressions.
JS Loops
Loops can execute a block of code a number of times.
JS Loop for
For Loops can execute a block of code a number of times.
JS Loop while
While loops execute a block of code as long as a specified condition is true.
JS Break
The break statement "jumps out" of loops and switches.
JS Continue
The continue statement skips the current iteration in a loop.
JS Control Flow
Control Flow is the order in which statements are executed in a program.
JS Strings
A JavaScript string is zero or more characters written inside quotes.
JS String Templates
Template Strings use back-ticks ( ) rather than the quotes ("") to define a string:
JS String Methods
Javascript strings are primitive and immutable: All string methods produce a new string without altering the original string.
JS String Search
| String indexOf() String lastIndexOf() String search() String match() | String matchAll() String includes() String startsWith() String endsWith() |
JS Numbers
Numbers can be written with or without decimals.
JS Number Methods
| Basic Methods Basic number methods can be used on any number: toString() toExponential() toFixed() toPrecision() valueOf() | Static Methods Static methods can
JS Number Properties
| Number.EPSILON Number.MAX_VALUE Number.MIN_VALUE | Number.MAX_SAFE_INTEGER Number.MIN_SAFE_INTEGER Number.POSITIVE_INFINITY Number.NEGATIVE_INFINITY Number.Na
JS Bitwise
! Bits in a Computer (https://www.w3schools.com/js/img_bits_500.jpg)
JS BigInt
BigInt is a JavaScript data type for handling and storing big integer values.
JS Functions
- Functions are reusable code blocks designed for particular tasks
Function Intro
Functions are reusable code blocks designed to perform a particular task.
Function Invocation
A JavaScript function runs when it is called.
Function Parameters
Parameters allow you to pass (send) values to a function.
Function Returns
A function can return a value back to the code that called it.
Function Arguments
In JavaScript, function parameters and arguments are distinct concepts:
Function Expressions
A function expression is a function stored in a variable.
Function Arrow
Arrow Functions allow a shorter syntax for function expressions.
JS Timers
JavaScript timers let you run a function after a delay or repeatedly at fixed intervals.
JS Objects
- Objects are variables that can store both values and functions
Object Intro
Objects are variables that can store both values and functions.
Object Properties
A JavaScript object is a collection of properties
Object Methods
Methods are actions that can be performed on objects.
Object this
In JavaScript, this is used to access the object that is calling a method.
Object Display
Displaying a JavaScript object will output object Object .
Object Constructors
Sometimes we need to create many objects of the same type.
JS Scope
Scope determines the accessibility (visibility) of variables.
JS Code Blocks
A code block or block statement is a group of statements enclosed within curly braces { }.
JS Hoisting
Hoisting is JavaScript's default behavior of moving declarations to the top.
JS var/let/const
The primary difference between var , let , and const lies in scoping mechanisms, reassignment rules, and how JavaScript handles them via hoisting.
JS Strict Mode
The "use strict" directive was new in ECMAScript version 5.
JS Dates
JavaScript Date Objects let us work with dates:
JS Date Formats
There are generally 3 types of JavaScript date input formats:
JS Date Get
In JavaScript, date objects are created with new Date() .
JS Date Set
Set Date methods let you set date values (years, months, days, hours, minutes, seconds, milliseconds) for a Date Object.
JS Arrays
An Array is an object type designed for storing data collections.
JS Array Constructor
The new Array() constructor creates an Array object.
JS Array Methods
| Array length Array toString() Array at() Array join() Array pop() Array push() Array shift() Array unshift() | Array isArray() Array delete() Array concat() A
JS Array Search
| Array indexOf() Array lastIndexOf() Array includes() | Array find() Array findIndex() Array findLast() Array findLastIndex() |
JS Array Sort
| Alphabetic Sort Array sort() Array reverse() Array toSorted() Array toReversed() Sorting Objects | Numeric Sort Numeric Sort Random Sort Math.min() Math.max()
JS Array Iterations
Array iteration methods operate on every array item.
JS Array const
In 2015, JavaScript introduced an important new keyword: const .
JS Sets
A JavaScript Set is a collection of unique values.
JS Set Methods
| new Set() add() clear() delete() entries() | forEach() has() keys() values() size |
JS Set Logic
| Logic Set Methods In JavaScript 2025, 7 new logical methods were added to the Set object: union() difference() intersection() isDisjointFrom() isSubsetOf() is
JS Set WeakSet
A JavaScript WeakSet is a collection of values where the values must be objects.
JS Maps
A JavaScript Map is an object that can store collections of key-value pairs, similar to a dictionary in other programming languages.
JS Map Methods
You can create a map by passing an array to the new Map() constructor:
JS Map WeakMap
A JavaScript WeakMap is a collection of key/value pairs where the keys must be objects.
JS Iterations
JavaScript loops repeat executing a block of code a number of times.
JS Iterables
Iterable can be iterated over with for...of loops
JS Iterators
An Iterator is an object that provides a standard way to access elements sequentially.
JS Generators
A JavaScript Function can only return one value.
JS Math
The JavaScript Math object allows you to perform mathematical tasks.
JS Math Random
Math.random() returns a random number between 0 (inclusive), and 1 (exclusive):
JS RegExp
A Regular Expression is a sequence of characters that forms a search pattern.
JS RegExp Flags
Flags are parameters that can modify how a regex pattern is used, such as making it case-insensitive or global.
JS RegExp Classes
Character Classes are characters enclosed in square brackets .
JS RegExp Metachars
Metacharacters are characters with a special meaning.
JS RegExp Assertions
Assertions matches Boundaries and Lookarounds:
JS RegExp Groups
Regular Expression Groups allow you to treat multiple characters as a single unit, extract specific parts of a match, or reference captured text later.
JS RegExp Quantifiers
Regular Expression (Regex) quantifiers define how many times the preceding character, group, or character class must occur in a string. They control the boundar
JS RegExp Patterns
Flags can be added to a regexp pattern to Modify its behavior:
JS RegExp Objects
In JavaScript, RegExp is a regular expression object with predefined properties and methods.
JS RegExp Methods
| compile() | Compiles a regular expression (Deprecated) |
JS Data Types
A JavaScript variable can hold 8 types of data.
JS Primitive Data
A JavaScript variable can hold 8 types of data.
JS Object Types
A JavaScript variable can be either a Primitive type or an Object type.
JS Symbols
Every Symbol value is unique, even if they have the same description.
JS typeof
The typeof operator returns the data type of a JavaScript variable.
JS undefined
In JavaScript, a variable without a value has the value undefined .
JS NaN
In JavaScript, NaN is short for Not a Number.
JS toString()
The JavaScript toString() method converts a variable (or a value) to a string.
JS toLocaleString()
The toLocaleString() method converts a value to a string, using local formatting rules.
JS Type Coercion
Type coercion is the automatic conversion of values from one data type to another.
JS Type Conversion
JavaScript variables can be converted to a new variable and another data type:
JS Destructuring
The destructuring assignment syntax can unpack objects into variables:
JS Errors
When executing JavaScript code, different errors can occur.
JS Errors Silent
A silent error will not stop your program. The execution will continue.
JS Error Statements
In JavaScript, the try statement is used to handle errors (also called exceptions) that may occur during code execution - without stopping the entire program.
JS Error Object
JavaScript has a built in error object that provides error information when an error occurs.
JS Debugging
Many beginners quit because they cannot debug.
Debug Console
The browser console is the most important debugging tool for JavaScript beginners.
Debug Breakpoints
Breakpoints let you pause JavaScript and inspect what is really happening.
Debug Errors
JavaScript error messages look scary, but most of them mean very simple things.
Debug Async
Async bugs are the hardest bugs for beginners.
JS Style Guide
Always use the same coding conventions for all your JavaScript projects.
JS Best Practices
Avoid global variables, avoid new , avoid == , avoid eval()
JS Mistakes
This chapter points out some common JavaScript mistakes.
JS Performance
Each statement in a loop, including the for statement, is executed for each iteration of the loop.
JS Projects New
In this project you will build a counter with buttons to:
JS Event Listener
Now using Event Listeners instead of Onclick Attributes.
JS To-Do List
In this project you will build a To-Do List.
JS Modal Popup
A modal is a popup window that appears on top of the page.
JS Form Validation
In this project you will build a form with validation.
JS Versions
- Temporal API The long-time-overdue successor to the buggy, 30-year-old Date object. Unlike Date, Temporal objects are immutable and provide first-class suppor
JS 2026
ECMAScript 2026 (ES2026), the 17th edition of the JavaScript language specification, was officially ratified by ECMA International on June 30, 2026.
JS 2025
The 16th edition of the ECMAScript standard, released in June 2025, includes several enhancements to make JavaScript more readable and efficient.
JS 2024
| Object.groupBy() | Groups object elements according to values returned from a callback function | |
JS 2023
| ! (Shebang) | Tells the operating system which interpreter to use to execute the script | |
JS 2022
Supported in all modern browsers since March 2023.
JS 2021
| Promise.any() | Takes promises as input and returns a single promise | | |
JS 2020
| BigInt | Stores values too big to store in a JavaScript number |
JS 2019
| String trimStart() | Removes whitespace from the start of a string | |
JS 2018
| Asynchronous Iteration | Allows the await keyword in for/of loops | |
JS 2017
| String padStart() | Pads the beginning of a string | |
JS 2016
Supported in all modern browsers since March 2017.
JS 2015 (ES6)
| The let keyword | Declares a variable with block scope |
JS 2009 (ES5)
| "use strict" | Allows code to be executed in "strict mode" |
JS 1999 (ES3)
| Regular expressions | Sequence of characters that forms a search pattern |
JS Versions
The current JavaScript version is ES2025.
JS History
JavaScript was invented by Brendan Eich in 1995.
JS HTML DOM
The HTML DOM (HTML Document Object Model) is an Object Model for HTML Documents.
HTML DOM API
The DOM API (Application Programming Interface) is a set of Methods and Properties that allow JavaScript to change the content, structure, and style of any HTML
Selecting Elements
Often, with JavaScript, you want to manipulate HTML elements.
Changing HTML
The HTML DOM allows JavaScript to change both the text and the content of HTML elements.
Changing CSS
The HTML DOM allows JavaScript to change the style of HTML elements.
Form Validation
HTML form validation can be done by JavaScript.
DOM Animations
Learn to create HTML animations using JavaScript.
JS HTML Events
HTML events are things that happen to HTML elements.
Mouse Events
Mouse Events happen when the user interacts with the mouse.
Keyboard Events
Keyboard Events happen when the user presses a key on the keyboard:
Load Events
Load Events happen when the browser has finished loading an element.
Manage Events
Event Management is about adding, removing, and controlling events.
Event Examples
A JavaScript can be executed when an event occurs, like when a user clicks on an HTML element.
Event Listener
document.getElementById("myBtn").addEventListener("click", displayDate);
JS HTML First
HTML-First is a way of building websites where HTML is the foundation of the page.
HTML Progressive
Progressive enhancement is a web development strategy where the basic version of a website works first.
HTML First Features
HTML has many built-in features that can replace small JavaScript solutions.
HTML First CSS
In HTML-first development, CSS is often the second step after HTML.
JS Web API
22 of 22 topics publishedJS Window API
The Browser Object Model (BOM) allows JavaScript to "talk to" the browser.
JS Screen
The window.screen object contains information about the user's screen.
JS Location
The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page.
JS History
The History API lets you work with the browser's session history.
JS Navigator
The navigator object contains information about the visitor's browser.
JS Popup Alert
JavaScript has three kinds of popup boxes:
JS Cookies
Cookies let you store user information in web pages.
JS Fetch API
The Fetch API interface lets you download (fetch) data from a web server.
JS JSON
! HTML (https://www.w3schools.com/js/img_json.jpg)
JSON Syntax
JSON has a very simple syntax for representing structured data.
JSON Values
In JSON, values must be one of the following data types:
JSON Parse
The JSON.parse() method converts JSON text into a JavaScript value.
JSON Stringify
The JSON.stringify() method converts a JavaScript value into JSON text.
JSON Fetch
JSON is often stored in files or returned by calls to web servers.
JSON HTML
After JSON has been parsed, the resulting JavaScript values can be displayed in HTML.
JSON vs XML
JSON and XML are text formats used to store and exchange structured information.
JS Web API
- It can extend the functionality of the browser
API Geolocation
The HTML Geolocation API is used to get the geographical position of a user.
API Web Pointer
The Pointer Events API is a modern web standard that provides a unified input model for handling various pointing devices, such as a mouse, pen/stylus, and touc
API Web Storage
The Web Storage API is a simple syntax for storing and retrieving data in the browser. It is very easy to use:
API Validation
| checkValidity() | Returns true if an input element contains valid data. |
API Web Worker
A web worker is a JavaScript running in the background, without affecting the performance of the page.
JS Advanced
75 of 75 topics publishedJS Temporal New
Temporal is the new standard for date and time in JavaScript.
Temporal Why
The Date object was created in 1995 and has some design issues that causes bugs.
Temporal vs Date
Learn the differences between JavaScript Date and Temporal
Temporal Duration
The Temporal.Duration object represents a length of time.
Temporal Instant
The Temporal.Instant object represents an exact moment in UTC time.
Temporal PlainDateTime
The Temporal.PlainDateTime object is a pure date and time object.
Temporal PlainDate
The Temporal.PlainDate object represents a calendar date without a time.
Temporal PlainYearM
The Temporal.PlainYearMonth object is a year and month object.
Temporal PlainMonthD
The Temporal.PlainMonthDay object is a month and day object.
Temporal PlainTime
The Temporal.PlainTime object is a time object without a date.
Temporal ZonedDate
The Temporal.ZonedDateTime object represents a date and time with a time zone.
Temporal Now
The Temporal.Now object provides 5 methods to get the system's date and time.
Temporal Arithmetic
JavaScript Temporal has methods for easy and reliable date and time arithmetic.
Temporal Since/Until
The since() method calculates the since duration between two dates.
Temporal Compare
In JavaScript, objects cannot be compared using operators like <, , ==, or ===.
Temporal Conversion
The table below shows how Temporal types can be converted.
Temporal Formats
Temporal dates can be serialized as strings in different ways:
Temporal Mistakes
Temporal is a powerful API, but it can be confusing at first.
Temporal Migrate
JavaScript Temporal was designed to replace the old Date object.
Temporal Standards
Temporal is based on the following standards:
JS Functions
These chapters are best after you understand basic functions (calling, parameters, return values, expressions, and arrows).
Function Definitions
Function Definitions vs Function Declarations
Function Callbacks
A JavaScript callback is a function passed as an argument to another function, which is then executed (or "called back") at a later point in time to complete a
Function this
When the this keyword is used in a function, it refers to an Object.
Function Call
The call() method can be used to call a function with a specific this.
Function Apply
The apply() method lets you write a method that can be used on different objects.
Function Bind
Like with call() and apply(), the bind() method can borrow a method from another object.
Function IIFE
An IIFE is short for an Immediately Invoked Function Expression.
Function Closures
Global variables can be made local (private) with closures.
JS Objects
When used in an object method, this refers to the object.
Object Definitions
An object literal is a list of property key:values inside curly braces { }.
Object this
return this.firstName + " " + this.lastName;
Object Iterations
// Copies properties from a source object to a target object
Object Get / Set
Getters and setters allow you to define Object Accessors (Computed Properties).
Object Management
Object.defineProperty(object, property, descriptor)
Object Protection
const car = {type:"Fiat", model:"500", color:"white"};
Object Prototypes
All JavaScript objects inherit properties and methods from a prototype:
JS Classes
ECMAScript 2015, also known as ES6, introduced JavaScript Classes.
JS Class Inheritance
To create a class inheritance, use the extends keyword.
JS Class Static
Static class methods are defined on the class itself.
JS Asynchronous
JavaScript normally runs one statement at a time.
Async Programming
While one task is running, no other JavaScript code can run. If a task takes a long time, the browser cannot respond to user actions until the task finishes.
Async Callbacks
A callback is a function passed as an argument to another function.
Async Promises
A Promise represents the future result of an asynchronous operation.
Async Await
The async and await keywords make Promise-based code easier to read.
Async Parallel
An await statement waits for one Promise before continuing.
Async Event Loop
JavaScript can only execute one piece of code at a time.
Async Fetch API
The Fetch API lets JavaScript download resources from a web server.
Async Mistakes
Asynchronous programming introduces new concepts:
Async Debugging
Asynchronous code can be more difficult to debug than synchronous code.
Async AbortControl
The AbortController Object lets you cancel asynchronous operations.
Async Web Workers
Until now, all examples in this tutorial run on the browser's main thread.
JS Modules
Modules are code blocks that can export and/or import functions and values.
Modules Export
A module uses the export keyword to share values with other files.
Modules Import
You can import modules in two ways, based on if they are named exports or default exports.
Modules Namespace
JavaScript creates a module namespace object.
Modules Dynamic
Note: Dynamic Import was introduced in ECMAScript 2020 Dynamic Import is a way to load JavaScript modules at runtime, rather than at the start of your pro
JS Meta & Proxy
Metaprogramming refers to a number of ways a program can manipulate itself:
Meta Reflect
Reflect is a object with methods for low-level operations on JavaScript objects.
Meta Proxy
A Proxy is a JavaScript object that can wrap other objects.
JS Typed Arrays
Typed arrays was designed for handling Binary Data.
Typed Methods
The from() method creates a new typed array from any iterable object:
Array Buffers
An ArrayBuffer is fixed a block of memory, often used to store typed arrays.
DataViews
The DataView Object lets you read and write multiple numeric types in an ArrayBuffer, at any byte offset, with optional control over endianness (byte order).
JS Atomics
The Atomics Object provides low-level atomic operations on shared memory.
JS DOM Navigation
With the HTML DOM, you can navigate the node tree using node relationships.
DOM Nodes
Adding and Removing Nodes (HTML Elements)
DOM Collections
The getElementsByTagName() method returns an HTMLCollection object.
DOM Node Lists
A NodeList object is a list (collection) of nodes extracted from a document.
JS Graphics
JavaScript libraries to use for all kinds of graphs:
JS Canvas
HTML Canvas is perfect for combining Scatter and Lines
JS Plotly
Plotly.js is a charting library that comes with over 40 chart types:
JS Chart.js
Chart.js is an free JavaScript library for making HTML-based charts. It is one of the simplest visualization libraries for JavaScript, and comes with the many b
JS Google Chart
From simple line charts to complex hierarchical tree maps, the Google Chart gallery provides a large number of ready-to-use chart types:
JS D3.js
D3.js is a JavaScript library for manipulating HTML data.
Old Technologies
15 of 15 topics publishedJS AJAX
AJAX is a developer's dream, because you can:
AJAX XMLHttp
The keystone of AJAX is the XMLHttpRequest object.
AJAX Request
The XMLHttpRequest object is used to request data from a server.
AJAX Response
| responseText | get the response data as a string |
AJAX XML File
AJAX can be used for interactive communication with an XML file.
AJAX PHP
AJAX is used to create more interactive applications.
AJAX ASP
AJAX is used to create more interactive applications.
AJAX Database
AJAX can be used for interactive communication with a database.
AJAX Applications
This chapter demonstrates some HTML applications using XML, HTTP, DOM, and JavaScript.
AJAX Examples
AJAX Examples notes
JS jQuery
jQuery was created in 2006 by John Resig. It was designed to handle Browser Incompatibilities and to simplify HTML DOM Manipulation, Event Handling, Animations,
jQuery HTML
jQuery was created in 2006 by John Resig. It was designed to handle Browser Incompatibilities and to simplify HTML DOM Manipulation, Event Handling, Animations,
jQuery CSS
jQuery was created in 2006 by John Resig. It was designed to handle Browser Incompatibilities and to simplify HTML DOM Manipulation, Event Handling, Animations,
jQuery DOM
jQuery was created in 2006 by John Resig. It was designed to handle Browser Incompatibilities and to simplify HTML DOM Manipulation, Event Handling, Animations,
JS JSONP
Warning: JSONP is a Legacy Technique. Modern applications normally use fetch() with CORS instead. JSONP executes returned data as JavaScript and should only
Ready to go from notes to a real career?
Join CodingNow 2.0's JavaScript course — live mentorship, hands-on projects, and 100% placement support in Delhi NCR.
Enroll Now — Free Demo AvailableJavaScript Notes – FAQs
What students search before reading JavaScript notes.