What is a String in JavaScript ?
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!
Contact Us