What is a String in JavaScript ?
Last Updated :
12 Feb, 2024
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);
|
Share your thoughts in the comments
Please Login to comment...