[Solved] Get only the first objects of an object in javascript [closed]


Try this:

var a = {"Coc Coc":{"30daysAgo":1}, Mozilla:{"30daysAgo":1}, BlackBerry:{"30daysAgo":1}, Safari:{"30daysAgo":140}, Firefox:{"30daysAgo":192}, YaBrowser:{"30daysAgo":6}, "Internet Explorer":{"30daysAgo":72}, "Safari (in-app)":{"30daysAgo":40}, "Android Browser":{"30daysAgo":3}, Chrome:{"30daysAgo":1387}, SeaMonkey:{"30daysAgo":1}, Edge:{"30daysAgo":7}, Opera:{"30daysAgo":7}};

var browsers = Object.keys(a).join(",");

Result:

Coc Coc,Mozilla,BlackBerry,Safari,Firefox,YaBrowser,Internet Explorer,Safari (in-app),Android Browser,Chrome,SeaMonkey,Edge,Opera

Fiddle

1

solved Get only the first objects of an object in javascript [closed]