Skip to content

Commit 1a8d3e4

Browse files
committed
Perlito5 - js - p5ArrayOfAlias - shift, pop
1 parent b50d8dc commit 1a8d3e4

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

html/perlito5.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,11 +1061,15 @@ function p5ArrayOfAlias(o) {
10611061
}
10621062
return this._array_.length / 2;
10631063
}
1064-
1065-
// TODO - shift()
1066-
1067-
// TODO - pop()
1068-
1064+
this.shift = function () {
1065+
var v0 = this._array_.shift();
1066+
return v0[this._array_.shift()];
1067+
}
1068+
this.pop = function () {
1069+
var v1 = this._array_.pop();
1070+
var v0 = this._array_.pop();
1071+
return v0[v1];
1072+
}
10691073
}
10701074

10711075

0 commit comments

Comments
 (0)