SyntaxError: Unexpected token

λ©”μ‹œμ§€

SyntaxError: expected expression, got "x"
SyntaxError: expected property name, got "x"
SyntaxError: expected target, got "x"
SyntaxError: expected rest argument name, got "x"
SyntaxError: expected closing parenthesis, got "x"
SyntaxError: expected '=>' after argument list, got "x"

μ—λŸ¬ νƒ€μž…

무엇이 잘λͺ»λ˜μ—ˆλ‚˜μš”?

νŠΉμ • μ–Έμ–΄ ꡬ쑰λ₯Ό μ˜ˆμƒν–ˆμ§€λ§Œ 무언가 λ‹€λ₯Έ 것이 μžˆμ—ˆμŠ΅λ‹ˆλ‹€. μ•„λ§ˆλ„, κ°„λ‹¨ν•œ μ˜€νƒ€μΌ κ²ƒμž…λ‹ˆλ‹€.

예제

μ˜ˆμƒν•˜μ§€ λͺ»ν•œ ν‘œν˜„μ‹

예λ₯Ό λ“€μ–΄, ν•¨μˆ˜λ₯Ό ν˜ΈμΆœν•  λ•Œ, μΈμˆ˜μ—μ„œ λ§ˆμ§€λ§‰ 뢀뢄에 μ½€λ§ˆλŠ” ν—ˆμš©λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. μžλ°”μŠ€ν¬λ¦½νŠΈλŠ” κ³„μ†ν•΄μ„œ λ‹€λ₯Έ μΈμžκ°€ μžˆμ„ 것이라고 κΈ°λŒ€ν•˜κΈ° λ•Œλ¬Έμž…λ‹ˆλ‹€.

Math.max(2, 42,);
// SyntaxError: expected expression, got ')'

콀마λ₯Ό μƒλž΅ν•˜κ±°λ‚˜ λ‹€λ₯Έ 인수λ₯Ό μΆ”κ°€ν•΄ μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

Math.max(2, 42);
Math.max(2, 42, 13+37);

μ°Έμ‘°