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 — Finished stack demo · reprogram2098/JavaScript-Lessons@ee9ca5b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Data_Structures/Stacks
    • main.js
Expand file treeCollapse file tree
Open diff view settings
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 01402775 — 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.