Strings

Covert All Letters of String to Lower Case in JavaScript

Strings are JavaScript’s data type used to represent the textual data and are most commonly used. Many people encounter a general requirement to make all letters of javaScript String in lowercase. This article will discuss different ways to convert all the letters to lowercase using various examples. We will also discuss how to convert to …

Covert All Letters of String to Lower Case in JavaScript Read More »

Javascript: Convert string to number

While working with javascript strings and numbers, there is often a requirement to convert string to numbers. This article demonstrates easy ways to convert strings to number in javascript using different methods and example illustrations. Table of Contents: Convert string to number using Number() Convert string to number using Math.floor Convert string to number using …

Javascript: Convert string to number Read More »

Javascript: Loop through array (6 ways)

There is a general requirement when developing in javascript that is to loop through an array. This article will discuss how to iterate through an array in javascript using six different methods and example illustrations. Table of Contents:- Loop through array in javascript using for loop Loop through array in javascript using for each loop Loop through …

Javascript: Loop through array (6 ways) Read More »

Javascript: String Replace Space with Dash

A general requirement while working with javascript is to process strings and replace particular characters with some other. One such condition is to replace spaces with the dash in javascript strings. Table of Contents:- Javascript string replace spaces with dash using replace() Javascript string replace spaces with dash using split() and join() Javascript string replace …

Javascript: String Replace Space with Dash Read More »

Javascript: Check if string contains special characters

This article will discuss checking if a string contains special characters in a javascript string using different methods and example illustrations. Table of Contents: Check if a string contains special characters using test() Check if a string contains special characters using indexOf() Check if a string contains special characters using test() Javascript’s test(string) method searches for …

Javascript: Check if string contains special characters Read More »

Javascript: Replace with RegEx Example

This article demonstrates how to use the replace() function in javascript with regular expressions using different examples of replacing characters from a string. Table of Contents: Introduction and Syntax of replace() function Example 1: Replace special characters from a string Example 2: Replace spaces from a string Example 3: Replace anything but digits from a string Introduction …

Javascript: Replace with RegEx Example Read More »

Javascript: Replace multiple spaces with a single space

A lot of standard requirements are there in javascript related to the processing of strings. One such generic requirement is to replace multiple spaces with a single space in a javascript string. This article will discuss and demonstrate how to remove duplicate spaces using various example illustrations. Table of Contents:- Replace multiple spaces with a …

Javascript: Replace multiple spaces with a single space Read More »

Javascript: Capitalize first letter of each word in a string

This article will discuss a general requirement to make the first letter of each word capital in a javascript string. Table of Contents:- Capitalize first letter of each word in string using Regular Expressions Capitalize first letter of each word in string using split() and for loop Capitalize first letter of each word in string …

Javascript: Capitalize first letter of each word in a string Read More »

Javascript: How to make first letter of a string uppercase

Strings are JavaScript’s data type used to represent the textual data and are most commonly used. Many people encounter a general requirement to Capitalize the first letter of a String. This article will discuss different ways to make the first letter uppercase using examples. Javascript’s toUpperCase() will return the calling string converted to uppercase. If …

Javascript: How to make first letter of a string uppercase Read More »

Scroll to Top