tell me when js function will be called as constructor function ?
if we write a simple js function then it will be called as constructor function ?
- function myFunction(a, b) {
- return a * b;
- }
- var x = myFunction(4, 3);
tell me why below js function is consider as constructor function ?
- function person(first, last, age, eye) {
- this.firstName = first;
- this.lastName = last;
- this.age = age;
- this.eyeColor = eye;
- }
- var myFather = new person("John", "Doe", 50, "blue");
- var myMother = new person("Sally", "Rally", 48, "green");
please guide me. thanks
Manikandan MurugesanPosted Jun 29, 2017, 9:30 AM
Posted Jun 29, 2017, 9:46 AM