Estaba siguiendo un tutorial que usa un archivo js para hacer dinámica una página estática y escribí todo palabra por palabra, pero mi página permanece estática cuando la abro con mi navegador. Tengo el archivo HTML y el archivo js en el mismo directorio.
ARCHIVO JS Y HTML
//some great message options const vibes = [ "... and you are awesome!", "... have an amazing day!", "... love to see you win!", "... can't wait to see what you accomplish today!", "... You got this!" ]; var vibe = vibes[Math.floor(Math.random() * Math.floor(vibes.length))]; // diplay a good vibe document.querySelector(".vibe").append(vibe); <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>A page for you</title> <style> body{ text-align:center; } div.container{ width: 400px; margin: 0 auto; } .love{ font-size: 4em; } </style> </head> <body> <div class="container"> <h1>This is a page for you</h1> </div class="vibe">You are great!</div> <div class="love"> ❤️ </div> </div> <script type="text/javascript" src="vibe.js"></script> </body> </html>¿Cómo puedo obtener el archivo html para elegir el script js y aleatorizar los mensajes?
Arregla esto;
</div class="vibe">You are great!</div>debería ser
<div class="vibe">You are great!</div>