LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

How do you create strings in JavaScript, and how do you join them together?

Strings are written in single or double quotes, and you join them with the + operator (or, more modern, template literals with backticks).

A string is any piece of text — a "character sequence". To tell JavaScript that something is text rather than a number or keyword, you wrap it in quotes. Single (') and double (") quotes both work and mean the same thing:

console.log('single quotes');
console.log("double quotes");

Concatenation — joining strings — uses the + operator:

console.log('abc' + 'def');   // abcdef

While we're writing code, comments let you leave notes the computer ignores. Everything after // on a line is a comment, and /* ... */ spans multiple lines:

// single-line comment (everything after // is ignored)

/* multi-line
   comment */

A more modern and readable way to build strings is the template literal, written with backticks `. Inside one, ${...} drops a variable's value straight into the text — no + needed:

let name = 'World';
console.log(`Hello ${name}!`);   // Hello World!

From Quiz: WEBT / Introduction to JavaScript | Updated: Jun 20, 2026