JavaScript

Dernière mise à jour : 26/05/2016

Hello world!

Énoncé

Écrivez un script qui affiche le message "Hello World !" sur la page.

Solution

Fichier "js/script.js"

document.writeln('Hello World!');

Fichier "index.html"

<!DOCTYPE html>
<html lang="fr">
  <head>
    <meta author="Sébastien Adam">
    <meta charset="UTF-8">
    <meta name="language" content="fr">
    <title>Hello world</title>
  </head>
  <body>
    <p>
      <script type="text/javascript" src="js/script.js"></script>
    </p>
  </body>
</html>