I'm trying currently to get only the first key of an object for my process. It would allow me to make some comparisons with the root of different objects.
currently I use a loop and break at the first instance. Maybe there is more relevant way to achieve this goal?
var objectKey
var p = {
    "p1": "value1",
    "p2": "value2",
    "p3": "value3"
};
for (var key in p) {
    if (p.hasOwnProperty(key)) {
        var objectKey=key;        
        break
    }
}
 console.log("the first key is: "  + objectKey)any hint would be great, thanks
 
    