Just for fun this works in JS 1.8.5
var obj = {a: 1, b: 2, c: 3};
Object.keys(obj)[0]; // "a"
This matches the same order that you would see doing
for (o in obj) { ... }
More Related Contents:
- How to skip the zero value in an array of objects? [duplicate]
- get all 3 digit number whose sum is 11 or we can say module is 1 in JS [closed]
- How do I check if an array includes a value in JavaScript?
- How do I test for an empty JavaScript object?
- How can I merge properties of two JavaScript objects dynamically?
- How to get all properties values of a JavaScript Object (without knowing the keys)?
- How to iterate over a JavaScript object?
- Converting JavaScript object with numeric keys into array
- Are Javascript arrays primitives? Strings? Objects?
- How to map more than one property from an array of objects
- How to transpose a javascript object into a key/value array
- Create an object from an array of keys and an array of values
- How to copy JavaScript object to new variable NOT by reference? [duplicate]
- How to sum the values of a JavaScript object?
- What is the difference between native objects and host objects?
- Create object from array
- Comparing two arrays of objects, and exclude the elements who match values into new array in JS
- Mongoose/MongoDB result fields appear undefined in Javascript
- What’s the difference between “{}” and “[]” while declaring a JavaScript array?
- Setting a variable equal to another variable [duplicate]
- Maps vs Objects in ES6, When to use?
- JavaScript, elegant way to check nested object properties for null/undefined [duplicate]
- Access JavaScript Object Literal value in same object [duplicate]
- Search array of objects for entry matching variable and check if it matches other fields
- Elegant way to copy only a part of an object [duplicate]
- Using JavaScript what’s the quickest way to recursively remove properties and values from an object?
- How to merge each object within arrays by index?
- Access numeric properties of an object using dot notation
- Convert array of objects to array of arrays
- Array of object deep comparison with lodash