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("") 
  1. can me proper use of curly , square bracket while coding sencha touch?

  2. 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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -