JSFiddle - React, Tailwind, and code Playground

by kalinin sergey

JavaScript

const cat = {
	lives: 9,
  jumps: () => {
  	console.log('what?!', this)
  	this.lives--;
  }
};
console.log('cat before', cat.lives);
cat.jumps();
console.log('cat after', cat.lives);

const dog = {
	lives: 9,
  jumps: function() {
  	this.lives--;
  }
};
console.log('dog before', dog.lives);
dog.jumps();
console.log('dog after', dog.lives);