Created
August 22, 2020 12:16
-
-
Save iamsaief/f92e3b34d1909d0e7cfe1195d73eec82 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, constructor, object */ | |
class Student { | |
constructor(name, id) { | |
this.name = name; | |
this.id = id; | |
this.university = "Harvard University"; | |
} | |
} | |
const student1 = new Student("Tom Hardy", 101); | |
const student2 = new Student("Chris Hemsworth", 102); | |
console.log(student1, student2); | |
console.log(student1.name, student2.name); | |
/** | |
* Output : | |
Student { | |
name: 'Tom Hardy', | |
id: 101, | |
university: 'Harvard University' | |
} Student { | |
name: 'Chris Hemsworth', | |
id: 102, | |
university: 'Harvard University' | |
} | |
*/ | |
// Output: Tom Hardy Chris Hemsworth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment