TreeviewCopyright © aleen42 all right reserved, powered by aleen42

Stacks Back

A stack is a list of elements that are accessible only from one end of the list, which is called the top, which is known as a last-in, first-out (LIFO) data structure, which means that you will firstly access the element stored most recently.

A Stack implementation

function Stack() {
    this.dataStore = []; = 0;

    this.push = push;
    this.pop = pop;
    this.peek = peek;

    this.clear = clear;
    this.length = length;

function push(element) {
    this.dataStore[] = element;

function pop() {
    if ( === 0) {
        return null;

    return this.dataStore.splice(, 1);

function peek() {
    return this.dataStore[ - 1];

function length() {

function clear() {
    this.dataStore.splice(0,; = 0;
Empty Comments
Sign in GitHub

As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.

Notice: This plugin has used Cookie to store your token with an expiration.