Refleksi JavaScript

let kossher = [ {player1:"kir"},{player2:"kos"},{player3:"kir"} ]

let tirisaam = {}

kossher.forEach((obj)=>{
	Object.getOwnPropertyNames(obj).forEach((propertyName)=>{  // getOwnPropertyNames : returns list of property names and i did a foreach on it.
		tirisaam[propertyName] = obj[propertyName]
    })
})

console.log(tirisaam) //Object { player1: "kir", player2: "kos", player3: "kir" }
Strange Shrew