getFirstMember(obj: Object);
obj. JSON object, name for the first member of which should be determined.
The getFirstMember method determines name of the first object member.
This method returns a String-type value.
To execute the example, add a link to PP.js scenario file to HTML page. Get name and value for the first member of the object:
// Determine object
var chartView = {
chartType: PP.getRandomString(7),
editMode: 0,
selectionEnabled: True,
};
// Get name and value of the first object member
var name = PP.getFirstMember(chartView);
var value = PP.getFirstValue(chartView);
if (PP.isDefined(value)) {
console.log("Value of the first member «" + name + "» is equal to «" + value + "».");
} else {
console.log("Value of the first member «" + name + "» is not determined.");
};
After executing the example the browser console displays name and value of the first object member:
Value of the first chartType member is EebzKbD.
See also: