Learnitweb

Category: JavaScript tutorial

  • Web Storage API in JavaScript

    1. Introduction The Web Storage API offers a more user-friendly way for browsers to store key-value pairs, serving as an intuitive alternative to cookies. 2. Concepts and usage The two mechanisms within Web Storage are as follows: The Window.sessionStorage and Window.localStorage properties provide access to these storage mechanisms. Each property returns an instance of a…

  • Event flow in JavaScript

    1. Introduction Event flow in JavaScript refers to the sequence in which events are propagated through the DOM (Document Object Model) when an event is triggered. Understanding event flow is crucial for handling events efficiently in your web applications. 2. Phases of event flow Event flow consists of three distinct phases: The sequence of these…

  • Managing Browser History with JavaScript

    1. Introduction The History API provides access to the browser’s session history through the history global object. It exposes useful methods and properties that let you navigate back and forth through the user’s history, and manipulate the contents of the history stack. Note that the History API is only available on the main thread (Window).…

  • delete operator in JavaScript

    1. Introduction The delete operator removes a property from an object. If the property’s value is an object and there are no more references to the object, the object held by that property is eventually released automatically. Because classes are automatically in strict mode, and private properties can only be legally referenced in class bodies,…

  • Data storage and eviction in browsers

    1. Introduction Web developers can use a number of technologies to store data in the user’s browser(i.e, on the local disk of the device the user is using to view the website). The amount of data that browsers allow websites to store, as well as the methods they use to handle data deletion when storage…

  • Pure Function in JavaScript

    1. Introduction A pure function is a function that adheres to two key principles: Pure functions are a foundational concept in functional programming and are widely appreciated for their simplicity, predictability, and testability. 2. Key Characteristics of Pure Functions 3. Examples of Pure Functions Pure Function: Addition It always returns the same result for the…

  • Currying in JavaScript

    1. Introduction Currying is a functional programming technique where a function that takes multiple arguments is transformed into a series of functions, each taking a single argument. This allows you to apply arguments to a function one at a time. In JavaScript, currying allows you to partially apply a function. In simple terms, you can…

  • Array.prototype.slice() method

    1. Introduction The slice() method creates a shallow copy of a specified section of an array, returning it as a new array object. The selection is based on the indices provided as start and end parameters, with end being exclusive. This operation does not alter the original array. 2. Example 3. Using negative indices In…

  • A07:2021 – Identification and Authentication Failures

    1. Overview Identification and Authentication Failures occur when mechanisms designed to verify the identity of users are improperly implemented, bypassed, or vulnerable to attacks. These vulnerabilities can lead to unauthorized access, impersonation, or account compromise. Confirmation of the user’s identity, authentication, and session management is critical to protect against authentication-related attacks. There may be authentication…

  • Scope in JavaScript

    1. Introduction The scope is a general concept in the field of computer science that refers to the parts of the program where a particular variable, function, etc., can be accessed. In other words, the scope of an identifier (variable, function, etc.) is the part of a program where it is visible or can be…