B322/individual/fullstack/s64/stack.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>