- 3
Why
Why when we use a function like this》function person (name, age) { this.name=name; this.age=age; 》》 and then they used 》this.yearofbirth=birthyear 》 why name and age was set between () by function and birth year not ?
1 Antwort
0
if you declare and initialize birthyear variable in the global scope then no need to pass that variable as a parameter.you get the access of birthyear inside the function.