This content originally appeared on DEV Community and was authored by Dharshini E
1.What is a String in JavaScript?
In JavaScript, a string is a sequence of characters
(letters, numbers, symbols, spaces) enclosed in quotes
.
Strings are used to represent text
such as names
, messages
, or any written data
.
Ways to Create a String:
1.Single quotes (' '):
let str1 = 'Hello World';
2.Double quotes (" "):
let str2 = "JavaScript is fun!";
3.Backticks ( ) → Template Literals:
let name = "Dharshini";
let str3 = `Hello, ${name}!`; // allows variables & expressions inside
console.log(str3); // Hello, Dharshini!
This content originally appeared on DEV Community and was authored by Dharshini E

Dharshini E | Sciencx (2025-09-01T02:49:05+00:00) JavaScript – String. Retrieved from https://www.scien.cx/2025/09/01/javascript-string/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.