JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" onclick="console.log(this)" value="Direct ref">
<input type="button" onclick="test()" value="Function call">
<input type="button" onclick="test.apply(this)" value="Function apply">
<input type="button" id="bob0" value=".onclick">
<input type="button" id="bob1" value=".addEventListener">
<input type="button" id="bob2" value="durh">

JavaScript

test = function () {
    console.log(this);   
}

document.getElementById('bob0').onclick = test;
document.getElementById('bob1').addEventListener(
    'click', test);
document.getElementById('bob2').onclick = new Function(
    'console.group("Wheee"); console.log(this); test(); console.groupEnd();');