Coggle requires JavaScript to display documents.
this
document.addEventListener('DOMContentLoaded', function() { var logo = document.querySelector('#logo') logo.addEventListener('click', function() { console.log('clicked') }) })
var firstName = "James", lastName = "West";
var user = { firstName: "Cory", lastName: "Sikahema", fullName: function() { setTimeout(function() { console.log(this.firstName + " " + this.lastName) }, 2000) } };
user.fullName()
> James West
bind
var user = { firstName: "Cory", lastName: "Sikahema", fullName: function() { setTimeout(function() { console.log(this.firstName + " " + this.lastName); }.bind(this), 2000) } };
> Cory Sikahema
var sum = function(num1, num2) { return num1 + num2: };
var sum = (num1, num2) => num1 + num2;
arguments
super
new
TypeError
var user = { firstName: "Cory", lastName: "Sikahema", fullName: function() { setTimeout(() => { console.log(this.firstName + " " + this.lastName); }, 2000) } };