You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To reference a property that is not a valid identifier, you can use segment-literal notation
However, nowhere on that page it is defined what a valid identifier is.
In JavaScript, it's a word consisting of letters, digits, $, or _, with the exception that it cannot start with a digit. Is it the same for Handlebars? It would be useful if this information were provided on the site.
The text was updated successfully, but these errors were encountered:
WTF is a "segment literal notation"? Other than a Google bomb, that is. The only two Google search results for that string are the expressions page, and this GitHub issue.
@dandv LOL I did not notice that. The handlebars-site explains what it is. In JavaScript, property names can be any string, i.e. the property name can contain any sequence of characters. Identifiers, on the other hand, are restricted to letters, digits, and the _, and $ characters. So, in order to denote a property name that is not a valid identifier, the bracket-notation, a.k.a. subscript-notation can be used, e.g. obj[ 'Not a valid identifier!!!' ]. The OP uses the term "segment-literal notation". Since that term doesn't appear anywhere else on the Internet, it appears to be an invention of the OP :P... probably a lapsus memoriae.
Thanks @simevidas :) I sort of figure out what it meant, though the example on the website introduced a period after the object: articles.[10].comments. Filed #27 for that.
Would be great if @wycats could check out GitHub... a bunch of low-hanging fruit here to fix, but would help new users stumble less.
The "expressions" page states:
However, nowhere on that page it is defined what a valid identifier is.
In JavaScript, it's a word consisting of letters, digits,
$
, or_
, with the exception that it cannot start with a digit. Is it the same for Handlebars? It would be useful if this information were provided on the site.The text was updated successfully, but these errors were encountered: