<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
document.addEventListener("keydown", function( event ) {
if (event.key == "w") {
console.log("앞으로 간다")
}
else if (event.key == "s") {
console.log("뒤로 간다")
}
else if (event.key == "a") {
console.log("왼쪽으로 간다")
}
else if (event.key == "d") {
console.log("오른쪽으로 간다")
}
})
</script>
</body>
</html>