JSFiddle - React, Tailwind, and code Playground
JavaScript
function Person(firstName){
this.firstName = firstName;
}
Person.prototype.speak = function(){
setTimeout(function(){
alert('my name is: ' + this.firstName)
}this, 10);
}
Person.prototype.speakArrowFunction = function(){
setTimeout(() => {
alert('my name is: ' + this.firstName)
}, 10);
}
new Person('alex').speak()
new Person('alex').speakArrowFunction()