Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Multiline Strings. Concatenating | JavaScript syntax
Introduction to JavaScript

Deslize para mostrar o menu

book
Multiline Strings. Concatenating

Concatenating Multiple Lines

We can implement a multi-line string by concatenation of every line of the multi-line string to the variable. Below we have a code example for it:

1234
let myStr = "This is my" + " multiline String " + " which is amazing"; console.log(myStr);
copy
Tarefa

Swipe to start coding

Take two variables named firstPart and secondPart and assign the values of "This is a" and " JavaScript book." respectively. The task is to concatenate the above variables using the + operator and store the concatenated string in a variable named book, and show value on the console.

Solução

Summary:

  • A string which comes on more than one line in the code is called Multiline String .

  • Template literals are used to implement multi-line string by using backticks.

  • Backslashes are used to implement multiline string.

  • Concatenation is used to implement multiline string.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 13

Pergunte à IA

expand
ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

book
Multiline Strings. Concatenating

Concatenating Multiple Lines

We can implement a multi-line string by concatenation of every line of the multi-line string to the variable. Below we have a code example for it:

1234
let myStr = "This is my" + " multiline String " + " which is amazing"; console.log(myStr);
copy
Tarefa

Swipe to start coding

Take two variables named firstPart and secondPart and assign the values of "This is a" and " JavaScript book." respectively. The task is to concatenate the above variables using the + operator and store the concatenated string in a variable named book, and show value on the console.

Solução

Summary:

  • A string which comes on more than one line in the code is called Multiline String .

  • Template literals are used to implement multi-line string by using backticks.

  • Backslashes are used to implement multiline string.

  • Concatenation is used to implement multiline string.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 13
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Sentimos muito que algo saiu errado. O que aconteceu?
some-alt