Retype This Passage
JavaScript Stack Class Typing Test
Improve your typing speed with a real JavaScript stack implementation using class syntax. Ideal for code-focused typing practice.
120s testbeginnerCode passage
Instructions
Type the code exactly as shown, preserving line breaks, spacing, punctuation, and capitalization. This test uses a JavaScript stack data structure, so syntax accuracy is important.
Timer02:00
WPM0
Accuracy100%
Progress0%
Mistakes0
javascript-stack-class-typing-test
class Stack {↵
constructor() {↵
this.items = [];↵
}↵
↵
push(value) {↵
this.items.push(value);↵
}↵
↵
pop() {↵
if (this.isEmpty()) {↵
return null;↵
}↵
↵
return this.items.pop();↵
}↵
↵
peek() {↵
return this.items[this.items.length - 1];↵
}↵
↵
isEmpty() {↵
return this.items.length === 0;↵
}↵
}↵
↵
const stack = new Stack();↵
stack.push(10);↵
stack.push(20);↵
console.log(stack.peek());
class Stack {↵
constructor() {↵
this.items = [];↵
}↵
↵
push(value) {↵
this.items.push(value);↵
}↵
↵
pop() {↵
if (this.isEmpty()) {↵
return null;↵
}↵
↵
return this.items.pop();↵
}↵
↵
peek() {↵
return this.items[this.items.length - 1];↵
}↵
↵
isEmpty() {↵
return this.items.length === 0;↵
}↵
}↵
↵
const stack = new Stack();↵
stack.push(10);↵
stack.push(20);↵
console.log(stack.peek());
The passage stays in place while your typed text lines up directly on top of it. Tip: use `Tab` for `⇄` and `Enter` for `↵` while typing the passage.
Correct chars: 0Typed chars: 0Mistakes: 0Status: Ready