JSFiddle - React, Tailwind, and code Playground

by MuLtDirectX

JavaScript

class Some {
	constructor(name){
  	name = this.name
  }
  
  getName(){
  	return this.name
  }
  
  setName(newName){
  	this.name = newName
  }
}

let obj1 = {name: 'Alex'}

const nameChanger = Some.prototype.setName.bind(this)

nameChanger(obj1, 'Mohhamad')

console.log(obj1)