forked from HelyeFab/spckEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack.js
63 lines (43 loc) · 1.16 KB
/
stack.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// // Class
// class Stack {
// // Constructor is method once we instantiate an object from this class
// constructor() {
// this.items = []
// this.count = 0
// }
// // Add element to the top of the stack
// push(element) {
// this.items[this.count] = element
// console.log(`${element} added to ${this.count}`);
// this.count++
// return this.count - 1
// }
// // Return and remove top element
// // Return undefined if stack is empty
// pop() {
// if (this.count === 0) return undefined
// let deleteItem = this.items[this.count - 1]
// this.count--
// console.log(`${deleteItem} removed`);
// return deleteItem
// }
// }
// // Object
// const stack = new Stack()
// stack.push(100);
// stack.push(200);
// stack.push(300);
// stack.push(400);
// stack.pop()
// const multiplication = multiply(5, 4);
// function multiply(a, b) {
// return a*b
// }
// console.log(multiplication);
console.log(secondThing());
function secondThing() {
return firstThing() + " SECOND THING"
}
function firstThing() {
return "FIRST THING"
}