Articles on Trending Technologies

Technical articles with clear explanations and examples

Tutorix - AI Tutor

How to create Empty Values String in JavaScript?

seetha
seetha
Updated on 15-Mar-2026 3K+ Views

In JavaScript, there are several ways to create empty string values. An empty string is a string with zero characters, represented by two quotation marks with nothing between them. Syntax let emptyString = ""; // Double quotes let emptyString = ''; // Single quotes let emptyString = ``; // Template literals let emptyString = String(); // String constructor Example: Creating Empty Strings ...

Read More

How to perform Multiline matching with JavaScript RegExp?

Moumita
Moumita
Updated on 15-Mar-2026 752 Views

To perform multiline matching in JavaScript, use the m flag with regular expressions. This flag makes ^ and $ anchors match the beginning and end of each line, not just the entire string. Syntax /pattern/m new RegExp("pattern", "m") How the m Flag Works Without the m flag, ^ matches only the start of the string and $ matches only the end. With the m flag, they match line boundaries created by (newline) characters. Example: Basic Multiline Matching JavaScript Regular ...

Read More

Write a program to find the index of particular element in an array in javascript?

Vivek Verma
Vivek Verma
Updated on 15-Mar-2026 1K+ Views

Finding the index of a particular element in an array is a common task in JavaScript. An array is an object that contains multiple values in a sequential order, with each element having a specific index position. 22 45 67 89 12 0 1 2 3 4 Array Elements Index ...

Read More

JavaScript program to decrement a date by 1 day

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 363 Views

JavaScript provides several methods to manipulate dates. To decrement a date by 1 day, we can use the setDate() and getDate() methods together. Syntax date.setDate(date.getDate() - 1); Parameters date.getDate() - Returns the current day of the month (1-31) date.setDate() - Sets the day of the month for the date object Example: Basic Date Decrement Decrement Date by 1 Day body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; ...

Read More

Implementing Linear Search in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 558 Views

Linear search is a simple algorithm that sequentially checks each element in an array until the target element is found or the end of the array is reached. It has a time complexity of O(n) in the worst case. How Linear Search Works Linear Search Process Array: [1, 19, 5, 11, 22, 55] Target: 22 1 i=0 19 i=1 ...

Read More

Recursion in array to find odd numbers and push to new variable JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 522 Views

We are required to write a recursive function, say pushRecursively(), which takes in an array of numbers and returns an object containing odd and even properties where odd is an array of odd numbers from input array and even an array of even numbers from input array. This has to be done using recursion and no type of loop method should be used. Syntax const pushRecursively = (arr, len = 0, odd = [], even = []) => { // Base case: if we've processed all elements if (len ...

Read More

How to set text in tag with JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 1K+ Views

In JavaScript, you can set text in HTML tags using various methods. This tutorial shows different approaches including jQuery and vanilla JavaScript. Using jQuery .html() Method First, create a element with an ID attribute: Replace This strong tag Then use jQuery to set the text content: $(document).ready(function(){ $("#strongDemo").html("Actual value of 5+10 is 15....."); }); Complete jQuery Example Set Text in Tag ...

Read More

How to list down all the cookies by name using JavaScript?

Rishi Rathor
Rishi Rathor
Updated on 15-Mar-2026 372 Views

To list all cookies by name in JavaScript, you access the document.cookie property, split it into individual cookie pairs, and extract the name-value pairs from each cookie. How document.cookie Works The document.cookie property returns all cookies as a single string, with each cookie separated by semicolons. For example: "name1=value1; name2=value2; name3=value3". Method 1: Basic Cookie Listing Here's a simple approach to list all cookies by splitting the cookie string: function ReadCookie() { ...

Read More

How to draw a star in HTML5 SVG?

Govinda Sai
Govinda Sai
Updated on 15-Mar-2026 9K+ Views

SVG stands for Scalable Vector Graphics and is a language for describing 2D-graphics and graphical applications in XML. Most web browsers can display SVG just like they can display PNG, GIF, and JPG. To draw a star in HTML5 SVG, we use the element. The key is to set the correct x and y coordinates for each point of the star, alternating between outer points (tips) and inner points (valleys). 5-Point Star using SVG Polygon ...

Read More

What are Complex Data types in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 3K+ Views

In this tutorial, we will learn about complex data types in JavaScript. JavaScript has multiple built-in data types to store data in different formats. The data types of JavaScript can be divided into two groups: primitive data types and non-primitive data types. Number, String, Boolean, Undefined and Null are primitive data types, whereas Array and Object are non-primitive data types. The typeof operator is used to identify data types. The primitive data types are simple and easy to use. In contrast, the non-primitive data types (Array and Object) are relatively more complex than primitive data types, so the ...

Read More
Showing 18701–18710 of 61,298 articles
Advertisements