function Person(name, age) { this.name = name; this.age = age; this.sayName = function() { document.write(this.name); } } // 생성자로 사용 var person1 = new Person("nam", 33); person1.sayName(); // nam document.write("<br>"); // 함수로 호출 이경우 프로퍼티와 메서드는 window 객체에 추가됩니다. Person("sin", 27); window.sayName(); // sin document.write("<br>"); // call() 또는 apply 메서드로 다른 객체의 스코프에서 호출 이경우 this는 person2가 됩니다. var person2 = {}; Person.call(person2, "yoon", 45); person2.sayName(); // yoon