You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
384 B
HTML
21 lines
384 B
HTML
<script>
|
|
let collection = [];
|
|
|
|
function addToStack(element) {
|
|
collection.push(element);
|
|
return collection;
|
|
}
|
|
|
|
function removeFromStack() {
|
|
collection.pop();
|
|
return collection;
|
|
}
|
|
|
|
function peek() {
|
|
return collection[collection.length-1];
|
|
}
|
|
|
|
function getLength() {
|
|
return collection.length;
|
|
}
|
|
</script> |