At-sign before square brackets

Viewed 123

I'm currently maintainging some DS/JS code in Demandware and I just found that :

var XmlReponse : XML = new XML(result.object.text);
status = XmlReponse.@["STATUS"];

What does this unusual "@[...]" syntax do ?

It could have something to do with ECMA-357 specification (aka "E4X"), but I'm not sure : in the DW docs (needs credentials), it is said :

"You can read values from an XML object the same way you would from standard ECMAScript objects"

var quantity = order.item(0).@quantity;
var singleItem = order.item.(@quantity == 1);

That seems to explain the @ but let me skeptical about the following square brackets, maybe some kind of dynamic property ?

Thanks :)

1 Answers
Related