개발문제해결/Exception

Brackets 자바스크립트(javascript) 첫 console.log 에러

타진 2018. 8. 31. 23:33
반응형



1. 'console' was used before it was defined.


2. ERROR: Unexpected console statement.[no-console]


3. ERROR: 'console' is not defined.[no-undef]



Brackets으로 처음 console.log를 하면 나올 수 있는 에러들이다.


웹을 뒤져서 해결했기에 다른 사람들은 고생하지 않길 바라는 마음에 적는다.


어떤 원리로 고쳐지는 지는 나도 모른다.









1. 'console' was used before it was defined.




맨 처음에 주석


/*jslint devel: true */


를 붙여준다.



https://stackoverflow.com/questions/40816924/jslint-throwing-error-when-using-console-log


이쪽에서 찾았다.











2. ERROR: Unexpected console statement.[no-console]



마찬가지로 주석을 붙여준다


/* eslint-disable no-console */






https://code.i-harness.com/ko/q/20a1666


이쪽에서 찾았다.










3. ERROR: 'console' is not defined.[no-undef]




/*eslint no-undef: "error"*/

/*eslint-env node*/



를 붙여준다.




https://eslint.org/docs/rules/no-undef


이쪽에서 확인할 수 있다.





다 붙여넣으면 정상 작동함을 확인할 수 있을 것이다.




반응형
댓글수5