I have an object that has about 23 columns. Is there a way to iterate through each column automatically? Rather than specifically selecting each column using .get("COLUMN_NAME")
?
Thanks guys.
That's say a Class
A
-- with fields'
id
, createdAt
, updatedAt
, a
, b
, c
and obj
is an instance of A
.
obj.attributes
is an object which hold a
, b
, c
and id
, createdAt
, updateAt
are properties of obj
.
The following is an example to show all fields' name except special field (id
, createdAt
, updatedAt
) in web console.
Object.keys(obj.attributes).forEach(function(fieldName) {
console.log(fieldName);
});