#1 (object)
function Person(f){
this.firstname = f;
alert(this.firstname);
}
var me = new Person('benny');
#2 (function)
function Person(f){
alert(f);
}
Person('benny');
Im new in js oop, I have knowledge of oop in PHP
My question is what's different between 1st one and 2nd one?
in php, if I create an obj, i will start with class{}
in JS, it seems like you can also create an obj var obj = {} OR like create it like a function?
can someone enplane how it works?
alert(me.firstname);that is not possible on the #2. But some should drop you an good link to an page, where this all is explaint in detail, i watched yesterday a vid that was about 2 hours only about that topic OOP in javascript