Write a variable in a text string using a dollar sign.
-----------------------------------------------------------------------------------------------------
Write a variable in a text string using a dollar sign.
Hello, today we're going to show how to write variables in text strings with using a dollar sign.
We see, that we have two variables declared and initialized, thus variable firstName with the value John and variable lastName with the value Cage.
First we write the variable firstName into the text string by joining strings, where we must always add a plus sign between the variable and the text. The text must be placed in apostrophes.
We write the variable lastName into a text string using a dollar sign and curly braces, in which we place the variable lastName. In this case, we place the entire text string in the apostrophes.
Now let's try to display the page and see that joining text strings with plus signs and joining strings using the dollar sign works the same and both entries display the variable correctly.
Thank you for watching this video and if you like, subscribe to this channel and put like.
En esta página del sitio puede ver el video en línea Write a variable in a text string using a dollar sign. - JavaScript Tutorial de Duración hora minuto segunda en buena calidad , que subió el usuario Programming for Everybody 01 enero 1970, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 1,494 veces y le gustó 10 a los espectadores. Disfruta viendo!