JSFiddle - React, Tailwind, and code Playground

by TheDiamondDoge

JavaScript

/* (function() {

  console.log('this is the start'); //1

  Promise.resolve(console.log('promise 1')) //2

  setTimeout(function cb1() { //8
    console.log('timeout 0');
  }, 2000);

  setTimeout(function cb() { //6
    console.log('timeout 1');
  }, 0);

  console.log('this is just a message'); //3

  setTimeout(function cb1() { //7
    console.log('timeout 2');
  });

  new Promise((res, rj) => res('promise 2')).then(console.log); //5

  console.log('this is the end?'); //4

})(); */

'use strict'

let phrase = "Hello";

if (true) {
  let user = "John";

  function sayHi() {
    alert(`${phrase}, ${user}`);
  }
}

sayHi();