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:
1234let myStr = "This is my" + " multiline String " + " which is amazing"; console.log(myStr);
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.
Solución
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.
¡Gracias por tus comentarios!
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Awesome!
Completion rate improved to 2
Multiline Strings. Concatenating
Desliza para mostrar el menú
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:
1234let myStr = "This is my" + " multiline String " + " which is amazing"; console.log(myStr);
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.
Solución
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.
¡Gracias por tus comentarios!
Awesome!
Completion rate improved to 2single