Created
June 29, 2022 03:36
-
-
Save natafaye/f6ba4ba900c84f2b5882115cbd5b81e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User { | |
constructor(username) { // firstName = "Natalie"; lastName = "Childs" | |
this.username = username; | |
this.isAdmin = false; | |
} | |
greet() { | |
alert("Hello " + this.username + "!") | |
} | |
} | |
// Object we are stamping out | |
//const natalie = new User("nataliechilds"); | |
// const natalie = { | |
// username: "nataliechilds", | |
// isAdmin: false, | |
// greet() { | |
// alert("Hello " + this.username + "!") | |
// } | |
// } | |
//natalie.greet(); | |
//const abcde = new User("abcde"); | |
// const abcde = { | |
// username: "abcde", | |
// isAdmin: false, | |
// greet() { | |
// alert("Hello " + this.username + "!") | |
// } | |
// } | |
//abcde.greet(); | |
const users = [ | |
new User("nataliechilds"), | |
new User("abcde") | |
] | |
//users[1].greet() | |
const natalie = users[0] | |
natalie.username = "thecoolestchilds"; | |
//users[0].greet() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment