Oops-1
by ramstheroyal
HTML
<div id='testTag'> </div>
JavaScript
var Student = (function() {
function Student(fn, ln) {
this.firstName = fn;
this.lastName = ln;
this.fullName = this.firstName + ' ' + this.lastName;
}
Student.prototype.sayHello = function() {
alert('Hello, Mr.' + this.fullName);
};
return Student;
})();
function greet(person) {
return 'Hello, ' + person.firstName + ' ' + person.lastName;
}
var st = new Student('Rama Rao', 'Manthri');
st.sayHello();
document.getElementById('testTag').innerHTML = greet(st);