Добавить
Уведомления

Basic JavaScript (23/111) | Escaping Literal Quotes in Strings | freeCodeCamp

Basic JavaScript (23/111) | Escaping Literal Quotes in Strings | freeCodeCamp Full playlist ? https://www.youtube.com/watch?v=xBMb0KylHpI&list=PLH_87_56BLl12l-tU3coWK7Nhm1IMURJz When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: " or ' inside of your string? In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash (\) in front of the quote. var sampleStr = "Alan said, \"Peter is learning JavaScript\"."; This signals to JavaScript that the following quote is not the end of the string, but should instead appear inside the string. So if you were to print this to the console, you would get: Alan said, "Peter is learning JavaScript". https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings

Иконка канала JavaScript Боты
15 подписчиков
12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

Basic JavaScript (23/111) | Escaping Literal Quotes in Strings | freeCodeCamp Full playlist ? https://www.youtube.com/watch?v=xBMb0KylHpI&list=PLH_87_56BLl12l-tU3coWK7Nhm1IMURJz When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: " or ' inside of your string? In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash (\) in front of the quote. var sampleStr = "Alan said, \"Peter is learning JavaScript\"."; This signals to JavaScript that the following quote is not the end of the string, but should instead appear inside the string. So if you were to print this to the console, you would get: Alan said, "Peter is learning JavaScript". https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings

, чтобы оставлять комментарии