Posts

Showing posts from 2020

Convert JS array to an object

var languages = ["english", "hindi", "german", "spanish"];
var languagesObj = { ...languages };
console.log(languagesObj); // {0: "english", 1: "hindi", 2: "german", 3: "spanish"}