JSFiddle - React, Tailwind, and code Playground

by calvintennant

JavaScript

var goodButton, badButton;

// Result: Event is logged to the console. as expected.
goodButton = document.createElement('button');
goodButton.innerHTML = 'goodButton';
goodButton.addEventListener('click', function(e) { console.log(e) });
document.body.appendChild(goodButton);

// Result: `Uncaught TypeError: Illegal invocation`.
badButton = document.createElement('button');
badButton.innerHTML = 'badButton';
badButton.addEventListener('click', console.log);
document.body.appendChild(badButton);