JSFiddle - React, Tailwind, and code Playground

by Vladymyr Shevchuk

JavaScript

function delay(f, ms) {
	return function () {
  	console.log(this);
  	setTimeout(() => f.apply(this, arguments), ms)
  }
}

const obj = {
  getName(name) {
  	console.log('obj', this);
    console.error(name);
  }
}

const f1000 = delay(obj.getName, 1000);

f1000('test');