JSFiddle - React, Tailwind, and code Playground

JavaScript

function test() {
//  foo(); // typeError "foo is not a function"
  bar(); // valid
//  baz(); // typeerror "baz is not a function "
//  spam(); // ReferenceError "spam is not defined"
  
  var foo = function () {}; // anonymous function expression (foo gets hoisted)
  function bar() {}  // function declaration (bar and the function body get hoisted)
  var baz = function spam() {}; // named function expression (only baz gets hoisted, spam is never declared)
  
  foo(); // valid
  bar(); // valid
  baz(); // valid
//  spam(); // referenceerror
}

test();