screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> </head> <body> <div id="app"> <h1>Javascript concatenate string and variable</h1> <p id="output"></p> </div> <script> window.onload = function () { var name = "John"; var age = 25; var profession = "web developer"; var message = `Hello, <span class="highlight">${name}</span>! You are <span class="highlight">${age}</span> years old and work as a <span class="highlight">${profession}</span>.`; // Access the paragraph element with the ID "output" and set its innerHTML to the message document.getElementById("output").innerHTML = message; } </script> <style> #app { text-align: center; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24); width: 600px; margin: 0 auto; padding: 20px; } .highlight { color: red; font-weight: bold; } </style> </body> </html>