개발세발

Uncaught SyntaxError: Unexpected reserved word (at i .....) 해결 본문

코딩공부/참고자료

Uncaught SyntaxError: Unexpected reserved word (at i .....) 해결

뉼👩🏻‍💻 2022. 7. 9. 17:49
728x90
반응형
SMALL

 

코드를 실행하는 데 자꾸 await 에서 오류가 나서 걸렸다.

 

 

아무리 생각해도 오타도 없고 다 맞는거 같은데 왜 오류가 났는지 이해가 안되서 코드도 다시 작성해보고 난리난리했다. 그래도 해결이 안되서 구글링하다가 답을 얻었다. 

 

https://stackoverflow.com/questions/66158135/syntaxerror-unexpected-reserved-word-await-node-js-is-correct-version

 

SyntaxError: Unexpected reserved word "await", node.js is correct version

I am trying to run a function asynchronously 20 times. I have the function definition: import axios from 'axios'; async function updateUser (url, user) { return new Promise((resolve, rejec...

stackoverflow.com

 

내코드가 아님에도 참 이해가 잘 됐따 ^^....

 

 

In order to use await you need to declare the function in which you are putting the await as async

 

함수에 async를 쓰세요 ...... 

 

기초적인 사항인데 이해도가 부족해서 꼼꼼하게 챙기질 못했다. 

이제는 안 까먹고 잘 쓸 수 있겠찌 ..?

728x90
반응형