How do you get the keys of a javascript object using underscorejs
I have a backbone model object that looks like this
{
lunsize: "big",
type: {mike: "who", james: "him"},
age: 89
}
In my template I have the following
<% var b = _.keys(this.model.attributes) %>
<% for (var i = 0; i < b.length; i++ ) { %>
<%= b[i] %>
<% } %>
I get the following expected output
lunsize
type
age
Although my code works as expected, am wondering is there a better way to achieve this result?