var maFonction = function() {
var a = 'boom';
return a;
};
alert(maFonction());
------------------------------------------------------------------------------
var a = 'bouya'
var maFonction = function() {
var a = 'boom';
return a;
};
alert(maFonction());
alert(a);
------------------------------------------------------------------------------
var a = 'bouya'
var maFonction = function() {
a = 'boom';
return a;
}
alert(maFonction());
alert(a);
------------------------------------------------------------------------------
Convention | Description | Example |
---|---|---|
Class | Class name should be in CamelCased | MyCustomClass |
Class name should contain alphanumeric characters. Numbers are permitted if it belongs to technical term. | Base64 | |
Do not use underscores, hyphens, or any other nonalphanumeric character. | ||
Class name should be with atleast one unique namespace separated by dot (.). | TopLevelNamespace.MyClassName | |
Classes that are not distributed by Sencha should never use Ext as the top-level namespace. | ||
The top-level namespaces and the actual class names should be in CamelCased, everything else should be all lower-cased. | TopNamespace.middnamespace.CustomClass | |
Source File | The names of the classes map directly to the file paths in which they are stored. As a result, there must only be one class per file. | Ext.util.Observable is stored in path/to/src/Ext/util/Observable.js MyTopLevelNamespace.util.JsonToXml is tored in path/to/src/MyTopLevelNamespace/util/ JsonToXml.js |
Methods | Method should always be in camelCased. | encodeUsingMd5(), getHtml() |
Variables | Variable should always be in camelCased. | var isGoodName var base64Encoder |
Constant variable should be in upper-case | var SALARY = 1000 | |
Private variable should start with underscore ‘_’ | var _privateVariable | |
Properties | Properties should always be in camelCased. Static properties should bein upper-case. | Ext.MessageBox.YES = "Yes" |
Conventions
Class System
Class | Description |
---|---|
Ext | The Ext namespace (global object) encapsulates all classes, singletons, and utility methods provided by Sencha libraries. |
Ext.Base | The root of all classes created with Ext.define. Ext.Base is the building block of all Ext classes. All classes in Ext inherit from Ext.Base. All prototype and static members of this class are inherited by all other classes. |
Ext.Class | Handles class creation throughout the framework. This is a low level factory that is used by Ext.ClassManagerand generally should not be used directly. |
Ext.ClassManager | Ext.ClassManager manages all classes and handles mapping from string class name to actual class objects throughout the whole framework. |
Ext.Loader | Ext.Loader is the heart of the new dynamic dependency loading capability in Ext JS 4+. It is most commonly used via the Ext.require shorthand. |
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});