I entered different values ββfrom nested loops into the object, resulting in something like this:
obj = ["blue", 1, "red", 4, "yellow", 2, "green", 7];
But I would like for him to return like this:
obj = [{"blue": 1}, {"red": 4}, {"yellow": 2}, {"green": 7}];
Do I need to manually create this syntax or is there a faster way?
source
share