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"

์—๋Ÿฌ ํƒ€์ž…

SyntaxError

๋ฌด์—‡์ด ์ž˜๋ชป๋˜์—ˆ๋‚˜์š”?

ํŠน์ • ์–ธ์–ด ๊ตฌ์กฐ๋ฅผ ์˜ˆ์ƒํ–ˆ์ง€๋งŒ ๋ฌด์–ธ๊ฐ€ ๋‹ค๋ฅธ ๊ฒƒ์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ์•„๋งˆ๋„, ๊ฐ„๋‹จํ•œ ์˜คํƒ€์ผ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์˜ˆ์ œ

์˜ˆ์ƒํ•˜์ง€ ๋ชปํ•œ ํ‘œํ˜„์‹

์˜ˆ๋ฅผ ๋“ค์–ด, ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ, ์ธ์ˆ˜์—์„œ ๋งˆ์ง€๋ง‰ ๋ถ€๋ถ„์— ์ฝค๋งˆ๋Š” ํ—ˆ์šฉ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ๊ณ„์†ํ•ด์„œ ๋‹ค๋ฅธ ์ธ์ž๊ฐ€ ์žˆ์„ ๊ฒƒ์ด๋ผ๊ณ  ๊ธฐ๋Œ€ํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

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

์ฝค๋งˆ๋ฅผ ์ƒ๋žตํ•˜๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์ธ์ˆ˜๋ฅผ ์ถ”๊ฐ€ํ•ด ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

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

์ฐธ์กฐ