평소에 너무 재밌게보고있는 수강생입니다
ES6 문법 막바지 강의수강중 안되는것이 있어 문의드립니다
--------------------------------------------------------------
// 그림그리기위한 최소한의 코드
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
canvas.width = window.innerWidth - 100;
canvas.heigth = window.innerHeight - 100;
//end
const dino = {
x: 10,
y: 200,
width: 50,
height: 50,
draw() {
ctx.fillStyle = "green";
ctx.fillRect(this.x, this.y, this.width, this.height);
console.log(this.x, this.y, this.width, this.height);
},
};
dino.draw();
--------------------------------------------------------------------------------
제가 뭘잘 못한건지
fillRect 부분이 제대로 안먹혀서 화면에 아무것도 안 나오는거 같습니다
숫자형으로 변경하면 잘나오는데 this.를 이용하면 화면에 아무것도 출력이안됩니다
콘솔에 this로 지정된 항목들을 출력하면 로그에 할당된값이 잘뜨는데
왜 화면에는 안그려지는지 모르겠습니다;