extjs - When to use square brackets and curly brackets in sencha touch? -
this might dumb question here goes.
i've been following this tutorial on sencha touch 2 app. i'm new ext js , can't understand when use square brackets : [ .. ]
or curly brackets : { .. }
.
ext.define("notesapp.view.noteslistcontainer", { extend: "ext.container", config: { items: [{ xtype: "toolbar", docked: "top", title: "my notes", items: [{ xtype: "spacer" }, { xtype: "button", text: "new", ui: "action", id:"new-note-btn" }] }] } });
and here
html: [ '<img src="http://staging.sencha.com/img/sencha.png" />', '<h1>welcome sencha touch</h1>', "<p>you're creating getting started app. demonstrates how ", "to use tabs, lists , forms create simple app</p>", '<h2>sencha touch 2</h2>' ].join("")
can me proper use of curly , square bracket while coding sencha touch?
why not go ahead curly brackets { .. } ? why ext js have use [ .. ] along { .. }?
this basic javascript.
the []
means array, {}
means object literal, so:
[{ xtype: 'foo' }, { xtype: 'bar' }]
is array of object literals.
Comments
Post a Comment