JSFiddle - React, Tailwind, and code Playground

by Abdul Ahmad

JavaScript

class One {
	get something() {
  	return 'something 2';
  }
  
  getMethod({ methodName } = {}) {
  	return getMethod({ methodName, instance: this });
  }
}

function getMethod({ methodName, instance } = {}) {
	const meth = instance[methodName];
  console.log('meth', meth);
}

const o = new One();
// o.getMethod({ methodName: 'uno' });
o.getMethod({ methodName: 'something' });