[JavaScript] Einfacher Timer

<!doctype html>
<html lang="de">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Timer demo</title>
  </head>
  <body>
    <script>
      'use strict';  
      (function () {
        function timer() {
          let st = Date.now();
          // Intervall 100ms
          setInterval(function() {
            let el = Date.now() - st;
            console.log((el / 1000).toFixed(1));
          }, 100);
        }

        document.addEventListener('DOMContentLoaded', timer);
      }());
    </script>
  </body>
</html>

[JavaScript] Date: Datum und Zeit

// https://www.w3schools.com/jsref/jsref_obj_date.asp
// https://javascript.info/date

// akt. Datum + Uhrzeit
let dt_curr = new Date();
console.log(dt_curr.toString());

// Datum: 31.12.2018, Uhrzeit: 12:10:20,0
// Monat startet mit Index 0!
let d = new Date(2018, 11, 31, 12, 10, 20, 0);

// Mon Dec 31 2018 12:10:20 GMT+0100
console.log(d.toString());
// Mon, 31 Dec 2018 11:10:20 GMT
console.log(d.toUTCString());
// 2018-12-31T11:10:20.000Z
console.log(d.toISOString());
// 31.12.2018, 12:10:20
console.log(d.toLocaleString('de-DE'));
// 31.12.2018
console.log(d.toLocaleDateString('de-DE'));
// 12:10:20
console.log(d.toLocaleTimeString('de-DE'));

// Anzahl Millisekunden, seit 01.01.1970 00:00:00 UTC
console.log(Date.now());