[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Errors/String_literal_EOL [Back]  [Original]

SyntaxError: unterminated string literal - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

SyntaxError: unterminated string literal

JavaScript "unterminated string literal" (') (")

js
SyntaxError: Unterminated string constant (Edge)
SyntaxError: unterminated string literal (Firefox)

SyntaxError

(') (") JavaScript

JavaScript

js
var longString = 'This is a very long string which needs
                  to wrap across multiple lines because
                  otherwise my code is unreadable.';
// SyntaxError: unterminated string literal

+ +

js
var longString =
  "This is a very long string which needs " +
  "to wrap across multiple lines because " +
  "otherwise my code is unreadable.";

"\" ()

js
var longString =
  "This is a very long string which needs \
to wrap across multiple lines because \
otherwise my code is unreadable.";

ECMAScript 2015

js
var longString = `This is a very long string which needs
                  to wrap across multiple lines because
                  otherwise my code is unreadable.`;


Web Proxy Viewer  |  New URL  |  Original Page