JSFiddle - React, Tailwind, and code Playground

by matox

JavaScript

function foo(x) {
  console.log(1, this);
  var tmp = 3;
  const arr = [1, 2, 3];

  function bar(y) {
    console.log(2, this);
    console.log(x + y + (++tmp)); // will log 16
    arr.map(function(b) {
      console.log(1, this);
      console.log(b);
    });
  }

  bar(10);
}

console.log(new foo(2));
//foo(2);