Private Variables in Javascript Class
· ☕ 2 min read
We define a class and its variables like so -
1 2 3 4 5 6 7 8 9 10 11 12 class UserData { name = ""; type = ""; internalUserFlag = false; constructor({ name, type }) { this.name = name; this.type = type; } } const student1 = new UserData({ name: "Neo" }); console.