Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Javascript Articles
Page 215 of 534
How to return an object by parsing http cookie header in JavaScript?
Cookies are small pieces of data that are sent from a website to a user's web browser. They are used to store information about the user, such as their preferences or login status. When a user visits a website, their web browser will send a request to the server. The server will then send a response, which includes a set of headers. One of these headers is the "Cookie" header, which contains a list of all the cookies that are associated with the website. Understanding Cookie Headers Cookie headers can contain multiple name-value pairs separated by semicolons. ...
Read MoreHow to make active tab in navigation menu using HTML CSS & JavaScript?
Creating an active tab navigation menu helps users understand which page or section they're currently viewing. This tutorial demonstrates how to build an interactive navigation menu using HTML, CSS, and JavaScript with proper active state management. HTML Structure The HTML structure uses a simple unordered list with navigation items. Each li element represents a tab, and anchor tags provide the clickable links. Home About Services Portfolio Contact CSS Styling The CSS creates the visual design and ...
Read MoreHow to filter values from an array using the comparator function in JavaScript?
In JavaScript, filtering an array can be done by using the filter() method. This method creates a new array with all elements that pass the test implemented by the provided callback function (comparator function). Syntax arr.filter(callback) Here callback is a comparator function used to test each element in the array arr. It should return true to keep the element, or false to filter it out. Using Array.filter() Method The most efficient way to filter values is using the built-in filter() method. Here's an example filtering odd numbers: ...
Read MoreHow to get index in a sorted array based on iterator function in JavaScript?
When working with sorted arrays in JavaScript, you often need to find the correct insertion position for a new element to maintain the sorted order. This article explores different methods to achieve this using iterator functions. Using Binary Search for Insertion Index The most efficient approach is to implement a binary search algorithm that finds the insertion point without modifying the original array. function findInsertionIndex(arr, value, compareFunction) { let left = 0; let right = arr.length; while (left < ...
Read MoreHow to render a list without rendering an engine in JavaScript?
In this tutorial, we'll explore how to render a list dynamically in JavaScript without using a rendering engine like React or Vue. We'll demonstrate various methods to create lists directly in the DOM using vanilla JavaScript and jQuery. Using Array.forEach() Method The Array.forEach() method iterates over an array and executes a callback function for each element. This is ideal for creating list items dynamically. forEach Example Rendering the list using the Array.forEach() Method ...
Read MoreHow to create a function that invokes each provided function using JavaScript?
In JavaScript, functions are first-class objects, which means they can be passed as arguments to other functions. This powerful feature enables creating functions that can invoke multiple other functions systematically. The "invoke-each" pattern creates a function that invokes each provided function with the same set of arguments. This pattern is particularly useful for executing multiple operations with shared data. Why Use the Invoke-Each Pattern? The invoke-each pattern serves several important purposes: Abstraction: It hides the complexity of invoking multiple functions, making code cleaner and more maintainable. Batch Operations: Execute ...
Read MoreHow to get an object containing parameters of current URL in JavaScript?
JavaScript provides several ways to extract URL parameters from the current page or any URL. This is useful for handling query strings, routing, and dynamic content based on URL parameters. Using the Location Object The easiest way to get information about the current URL is to use the Location object. This object is a property of the window object and contains information about the current URL. // Get the entire URL var ...
Read MoreHow to Design a Calculator with Neumorphism Effect/Soft UI in JavaScript?
In this tutorial, we will create a calculator using JavaScript with a neumorphic effect, also known as soft UI. Neumorphism is a modern design trend characterized by soft, rounded edges and subtle inset/outset shadows that create a tactile, embossed appearance. What is Neumorphism? Neumorphism combines elements of skeuomorphism and flat design. It creates depth through subtle shadows and highlights, making UI elements appear to be extruded from or pressed into the background surface. Planning the Calculator Layout Our calculator will include: Two input fields for entering numbers One output field to display results Operation ...
Read MoreWhat are the attributes that work differently between React and HTML?
React and HTML handle attributes differently, which can cause confusion for developers. While HTML attributes are always strings, React treats some attributes as JavaScript expressions and has specific naming conventions that differ from standard HTML. Key Differences in Attribute Handling The main differences between React and HTML attributes include: Naming Convention: React uses camelCase (onClick) vs HTML's lowercase (onclick) JavaScript Expressions: React attributes can accept JavaScript functions and expressions Special Attributes: Some HTML attributes have different names in React Boolean Handling: React handles boolean attributes differently than HTML Event Handler Attributes React event ...
Read MoreHow to design a video slide animation effect using HTML CSS JavaScript?
In this tutorial, we will learn how to create a captivating video slide animation effect using HTML, CSS, and JavaScript. This animation makes a video element slide smoothly across the screen, creating an engaging visual effect for web applications. Understanding CSS Keyframes The foundation of our animation is CSS keyframes. A keyframe rule defines how CSS properties change over time during an animation. For our sliding video, we'll use the transform property with translateX() to move the video horizontally. @keyframes slide { from { transform: translateX(-100%); ...
Read More