GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge remote-tracking branch 'refs/remotes/buckyroberts/master' · MorrielAlexis/JavaScript-Lessons@0e70b8f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Data_Structures/Stacks
    • README.md
    • main.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Data_Structures/Stacks/README.md‎

Copy file name to clipboard
+7-2Lines changed: 7 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
# Title
1+
# Stacks
22

3-
Description
3+
A stack is a basic data structure that can be logically thought as linear structure represented by a real physical
4+
stack or pile, a structure where insertion and deletion of items takes place at one end called top of the stack. The
5+
basic concept can be illustrated by thinking of your data set as a stack of plates or books where you can only take the
6+
top item off the stack in order to remove things from it.
7+
8+
![](http://i.imgur.com/dax54C9.jpg)
Collapse file

‎Data_Structures/Stacks/main.js‎

Copy file name to clipboardExpand all lines: Data_Structures/Stacks/main.js
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function Stack() {
1313
return items.length == 0;
1414
};
1515

16-
// view last item added to stack
16+
// return last item added to stack
1717
this.peek = function () {
1818
return items[items.length - 1];
1919
};
@@ -39,8 +39,13 @@ let buckysStack = new Stack();
3939
console.log(buckysStack.isEmpty());
4040

4141
buckysStack.push(87);
42-
buckysStack.push(71);
43-
44-
console.log(buckysStack.peek());
4542
buckysStack.push(29);
43+
buckysStack.push(71);
4644
buckysStack.print();
45+
console.log(buckysStack.peek());
46+
47+
console.log('--------------------');
48+
49+
console.log(buckysStack.isEmpty());
50+
buckysStack.clear();
51+
console.log(buckysStack.isEmpty());

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.