Loading

Quipoin Menu

Learn • Practice • Grow

java-script / String in Javascript
interview

Q1. What is a String in JavaScript?
A string is a data type used to store text or characters. Strings are written inside quotes.

JavaScript allows three types of quotes:
  • Single quotes (' ')
  • Double quotes (" ")
  • Backticks (` `)
Example
let name = "John";
let city = 'London';
let message = `Hello World`;


Q2. What is String Concatenation?
String concatenation means joining two or more strings together.

Example
let firstName = "John";
let lastName = "Doe";

let fullName = firstName + " " + lastName;
console.log(fullName);

Output
John Doe


Q3. What is Template Literal in JavaScript?
Template literals allow embedding variables and expressions inside strings using backticks.

Example
let name = "John";
let message = `Welcome ${name}`;
console.log(message);

Output
Welcome John

Template literals make string formatting easier.


Q4. How Can You Find the Length of a String?
JavaScript provides the length property to find the number of characters in a string.

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

Output
10


Q5. How Can You Convert String Case in JavaScript?
JavaScript provides methods to change letter case.

toUpperCase( )
let text = "hello";
console.log(text.toUpperCase());

toLowerCase( )
let text = "HELLO";
console.log(text.toLowerCase());