Passed
Push — master ( 06adb3...07a6a5 )
by Nguyen
41s queued 15s
created

topics/stack/index.js   A

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 20
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 12
mnd 0
bc 0
fnc 5
dl 0
loc 20
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10

5 Functions

Rating   Name   Duplication   Size   Complexity  
A Stack.push 0 3 1
A Stack.top 0 3 1
A Stack.pop 0 3 1
A Stack.constructor 0 3 1
A Stack.isEmpty 0 3 1
1
class Stack {
2
    // put your code here to address problems
3
    constructor() {
4
        this.data = [];
5
    }
6
    push(record) {
7
        this.data.push(record);
8
    }
9
    pop() {
10
        return this.data.pop();
11
    }
12
    top() {
13
        return this.data[this.data.length - 1];
14
    }
15
    isEmpty() {
16
        return this.data.length === 0
17
    }
18
}
19
20
module.exports = Stack;
21