javascript - Adding an object into an array -


i have following object:

{   "eekvb3cnweze":{      "name":"hi",   },   "brv1r4c6bznd":{      "name":"yup",   },   "krwrxju6aljz":{      "name":"okay",   } } 

i trying add each of these items array. following code reason, [] in console.log

could me figure out what's wrong?

$scope.items = [];  $http.get("/url").success(function(data) {     $.each(data, function(key, value) { $scope.items[key] = value; });     console.log($scope.items); }); 

named keys ignored when log array.

if want them show there, you'll need replace key (in bit of code $scope.items[key]) number or use .push(value) instead of assignment.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -