< 풀이 과정 >
d : 100 a: 97 w:119 s:115 | : 124
그림 1의 event.keyCode 에 주목한다. 키보드를 누르는 이벤트에 반응하여, d를 눌렀을 때에 원래 있던 별의 위치가 아래와 같이 변경되는 것을 볼 수 있었다.
| ( 파이프 ) 를 입력하면, 이벤트가 발생하여 문제를 해결할 수 있다.
한줄 평 : innerhtml이 있어서 xss 만 생각했었는데.. 익숙함에 속지 말자?
< 참고 >
https://han-py.tistory.com/544
[javascript] event.keyCode 기초 정리
보통 우리는 키보드를 javascript로 핸들링 할때, keyCode를 사용해서 적용 한다. 왜냐하면 구글링을 하다보면 KeyCode에 관한 내용들이 많기 때문이다. 하지만 아래의 문서를 보면 Deprecated 되었다고 나
han-py.tistory.com
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#browser_compatibility
KeyboardEvent: keyCode property - Web APIs | MDN
The deprecated KeyboardEvent.keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key.
developer.mozilla.org