ExtJS learning ----------- Ext. Array, ExtJS extension of Array in javascript (Instance)
(1) clean
Var arr = [1, 2, null, 3, '']; alert (Ext. array. clean (arr); // clean object :( value = null) | (value = undefined) | (! AllowEmptyString? Value = '': false) | (Ext. isArray (value) & value. length = 0) // The result is 1, 2, 3.
(2) difference
// Differencevar arr1 = [, 3]; var arr2 = [, 6]; alert (Ext. Array. difference (arr1, arr2); // The result is 1, 3.
(3) each
// Eachvar arr = [1, 2, 4]; Ext. array. each (arr, function (item) {if (item = 4) {return false;} alert (item ); // when the function returns false internally, iteration will be stopped}); // result: the pop-up dialog box appears, showing 1 2 3, not 4(4) erase
// Erasevar arr = [1, 3, 4, 5]; alert (Ext. Array. erase (arr, 2, 2); // The Array starts from 0. Delete two elements from the position where the subscript is 2 (inclusive). // result: 1, 2, 3
(5) every
// Everyvar arr = [1, 2, 5, 6, 9, 10]; var flag = Ext. array. every (arr, function (item) {if (item >=7) {return false ;}else {return true ;}); alert (flag); // result: false(6) filter
// Filtervar arr = [1, 2, 3, 4, 10, 18, 23]; var newarr = Ext. array. filter (arr, function (item) {if (item> 10) {return false ;}else {return true ;}); alert (newarr); // result: 1, 2, 3, 4, 10(7) include
// Includevar arr = [1, 2, 3, 4]; Ext. Array. include (arr, 2); alert (arr); // result: 1, 2, 3, 4
(8) unique
// Unqiuevar arr = [, 5, 21,]; alert (Ext. array. unique (arr); // remove the repeated items in the array using the characteristics of the js object. The key of the obj cannot be repeated var obj ={}; for (var I = 0, len = arr. length; I