자바스크립트는 프로토타입 기반 언어이지만 클래스를 사용할 수는 있다. class User { constructor(first, last) { this.firstName = first; this.lastName = last; } getFullName() { return `${this.firstName} ${this.lastName}` } } const bayern = new User('Tomas', 'Muller'); const munich = new User('Joshua', 'Kimmich'); console.log(bayern.getFullName()); //Tomas Muller console.log(munich.getFullName()); // Joshua Kimmich 클래스의 정의 클래스는 객..
prototype
javascript는 프로토타입 기반 언어로, 클래스를 사용할 수는 있음 (ES6) 요즘은 클래스를 사용하지만, 그것을 공부하기 위해 기초적인 원리를 알아야 함 function User(first, last) { this.firstName = first; this.lastName = last; } const cat = new User('Haerin','Kang'); const siuuu = new User('Cristiano', 'Ronaldo'); console.log(cat); // User { firstName: 'Haerin', lastName: 'Kang' } console.log(siuuu); // User { firstName: 'Cristiano', lastName: 'Ronaldo' } ..