Javascript – How to access an access array item by index in handlebars

handlebars.jsjavascript

I am trying to specify the index of an item in an array within a handlebars template:

{
  people: [
    {"name":"Yehuda Katz"},
    {"name":"Luke"},
    {"name":"Naomi"}
  ]
}

using this:

<ul id="luke_should_be_here">
{{people[1].name}}
</ul>

If the above is not possible, how would I write a helper that could access a spefic item within the array?

Best Answer

Try this:

<ul id="luke_should_be_here">
{{people.1.name}}
</ul>