ch03_test18.js
var person1={name: '소녀시대', age:20}; var person2={name:'걸스데이', age:21}; function Person(name, age){ this.name =name; this.age=age; } Person.prototype.walk =function(speed){ console.log(speed + " km 속도로 걸어갑니다.") ; }; var person3 = new Person('소녀시대', 20); var person4 = new Person('걸스데이', 22); person3.walk(10);
Command: node "C:/Program Files (x86)/Brackets/www/macaronics/ch03_test18.js"
Working directory: C:/Program Files (x86)/Brackets/www/macaronics/
10 km 속도로 걸어갑니다.
Program exited with code 0
댓글 ( 4)
댓글 남기기