Open In App

What is a String in JavaScript ?

Last Updated : 12 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

In JavaScript, a string is a data type used to represent a sequence of characters. Strings are typically used to store and manipulate text-based data. Strings can contain letters, numbers, symbols, and whitespace characters.

Example: Here, the variable greeting is assigned a string value "Hello, world!", which represents a common greeting message. The string is enclosed within double quotes ("), indicating its beginning and end.

Javascript




let greeting = "Hello, world!";
console.log(greeting); // Output: Hello, world!


Output

Hello, world!

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads