Last active
March 2, 2024 16:56
-
-
Save royib/e2b7b0aea5f5709c328aa1cea4af0756 to your computer and use it in GitHub Desktop.
Class article - constructor functions
This file contains 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
function Person(firstName, lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
// Creating a new instance of Person | |
const newPerson = new Person("john", "duo"); | |
console.log(newPerson.firstName); // Output: john | |
console.log(newPerson.lastName); // Output: duo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment