Better variables scoping

This commit is contained in:
Frederic Junod
2018-05-14 14:28:31 +02:00
parent 7f0043694d
commit 9f3b103bbf
4 changed files with 15 additions and 24 deletions

View File

@@ -115,8 +115,7 @@ Collection.prototype.clear = function() {
* @api
*/
Collection.prototype.extend = function(arr) {
let i, ii;
for (i = 0, ii = arr.length; i < ii; ++i) {
for (let i = 0, ii = arr.length; i < ii; ++i) {
this.push(arr[i]);
}
return this;
@@ -225,8 +224,7 @@ Collection.prototype.push = function(elem) {
*/
Collection.prototype.remove = function(elem) {
const arr = this.array_;
let i, ii;
for (i = 0, ii = arr.length; i < ii; ++i) {
for (let i = 0, ii = arr.length; i < ii; ++i) {
if (arr[i] === elem) {
return this.removeAt(i);
}
@@ -270,8 +268,7 @@ Collection.prototype.setAt = function(index, elem) {
this.dispatchEvent(
new CollectionEvent(CollectionEventType.ADD, elem));
} else {
let j;
for (j = n; j < index; ++j) {
for (let j = n; j < index; ++j) {
this.insertAt(j, undefined);
}
this.insertAt(index, elem);