Created
December 4, 2017 08:46
-
-
Save woosungchu/565d4ea72dd37d3cd030222472fdaf6e to your computer and use it in GitHub Desktop.
newFunction.js
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
// https://jsfiddle.net/woosungchu/krs21ac2/ | |
function createEmployeeObject3(firstName, lastName, gender, designation){ | |
var employee={}; | |
employee.firstName=firstName; | |
employee.lastName=lastName; | |
employee.gender=gender; | |
employee.designation=designation; | |
return employee; | |
} | |
var employee3=createEmployeeObject3("Harry", "Dsouza", "M", "Project Manager"); | |
console.log(employee3) | |
function createEmployeeObject4(firstName, lastName, gender, designation){ | |
this.firstName=firstName; | |
this.lastName=lastName; | |
this.gender=gender; | |
this.designation=designation; | |
} | |
var employee4=new createEmployeeObject4("Alan", "Marks", "F", "Business Analyst"); | |
console.log(employee4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/22401553/what-are-all-the-difference-between-function-and-constructor-function-in-javascr
https://jsfiddle.net/woosungchu/krs21ac2/