Loading

Quipoin Menu

Learn • Practice • Grow

java-script / String Methods
interview

Q1. What Are String Methods in JavaScript?
String methods are built-in functions used to manipulate and work with text values. These methods help perform operations like searching, replacing, converting case, and extracting text.
String methods do not modify the original string because strings are immutable. They return a new string instead.


Q2. What is the length Property in Strings?
The length property returns the number of characters in a string.

Example
let text = "JavaScript";
console.log(text.length);

Output
10


Q3. What is the slice() Method?
The slice() method extracts a portion of a string and returns it as a new string.

Example
let text = "JavaScript";
console.log(text.slice(0, 4));

Output
Java


Q4. What is the substring() Method?
substring() is similar to slice() and is used to extract characters between two positions.

Example
let text = "JavaScript";
console.log(text.substring(4, 10));

Output
Script


Q5. What is the replace() Method?
The replace() method replaces part of a string with another value.

Example
let text = "Hello World";
console.log(text.replace("World", "JavaScript"));

Output
Hello JavaScript