Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/marijnh/Eloquent-JavaScript
/ lock
Method
lock
code/solutions/08_2_the_locked_box.js:6–6 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
4
5
unlock() { this.locked = false; }
6
lock() { this.locked = true; }
7
get content() {
8
if
(this.locked) throw
new
Error(
"Locked!"
);
9
return
this.#content;
Callers
1
withBoxUnlocked
Function · 0.80
Calls
no outgoing calls
Tested by
no test coverage detected