SyntaxError: missing : after property id

Yuri Lee·2021년 2월 22일
0

배경

데이터를 불러오는 과정에서 다음의 에러가 발생했다.

SyntaxError: Expected ':' (Edge)
SyntaxError: missing : after property id (Firefox)

이유

var obj = { propertyKey; };
// SyntaxError: missing : after property id

객체를 불러올 때 내가 = (등호)를 사용하고 있었기 때문에 발생한 에러였다.

해결

var obj = { propertyKey: null };

= 를 사용하지 않고 : 를 사용하면 문제가 해결된다. 😎


https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Errors/Missing_colon_after_property_id

profile
Step by step goes a long way ✨

0개의 댓글