Strings in JavaScript

As we mentioned previously, data can be of various types. One of the types is numbers, we have already studied it a little. Let's now move on to strings.

Strings are created using quotes:

let str = 'abc'; alert(str); // shows 'abc'

Quotes can be either single or double:

let str = "abc"; alert(str); // shows 'abc'

There is no difference between single and double quotes in JavaScript. Their use depends on your preferences. I prefer to use single quotes, so they will be used throughout the rest of the tutorial.

Hereinafter, if the output result is a string, then I quote it to show that it is a string, such a way: shows 'abc'. No quotes will appear when you output a string with alert (that is, what I have written inside the quotes will be displayed on the screen).

Create the string with your first name and one with your last name. Display this information on the screen.

enru