You can use Object.keys()
and map()
to do this
var obj = {"1":5,"2":7,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0}
var result = Object.keys(obj).map((key) => [Number(key), obj[key]]);
console.log(result);
More Related Contents:
- javascript slice without using built in method [closed]
- How do I check if an array includes a value in JavaScript?
- Short circuit Array.forEach like calling break
- Most efficient method to groupby on an array of objects
- Convert Array to Object
- Filter array of objects based on another array in javascript
- Check if an array contains any element of another array in JavaScript
- Why is [1,2] + [3,4] = “1,23,4” in JavaScript?
- Why does typeof array with objects return “object” and not “array”? [duplicate]
- How can I access and process nested objects, arrays or JSON?
- Better way to sum a property value in an array
- Remove last item from array
- Filter array of objects with another array of objects
- javascript extract certain properties from all objects in array
- Is a JavaScript array index a string or an integer?
- Javascript sort function. Sort by First then by Second
- Convert javascript object or array to json for ajax data
- Obtain smallest value from array in Javascript?
- No semicolon before [] is causing error in JavaScript
- How do I remove objects from a JavaScript associative array?
- How to merge multiple array of object by ID in javascript?
- How to convert an array of key-value tuples into an object
- Checking for duplicate strings in JavaScript array
- Sort an array to have specific items first in the array
- Sort an array of objects by multiple properties
- Using setInterval() with a .map method in array and returning as a promise
- How to create an array of object literals in a loop?
- Lodash create collection from duplicate object keys
- Populating JavaScript Array from JSP List
- Group and count values in an array