MCPcopy Create free account
hub / github.com/CodeWithHarry/Sigma-Web-Dev-Course / User

Class User

Video 80/gs.js:1–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class User {
2
3 constructor(name) {
4 // invokes the setter
5 this.name = name;
6 }
7
8 get name() {
9 return this._name;
10 }
11
12 set name(value) {
13 if (value.length < 4) {
14 console.log("Name is too short.");
15 return;
16 }
17 this._name = value;
18 }
19
20 }
21
22 let user = new User("John");
23 console.log(user.name); // John

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected