Wednesday, October 16, 2019

[JS][Example] JavaScript ES6 feature : Multi-line Strings


ECMAScript 6 :
let lines = `line 1
line 2
line 3
line 4
line 5
`;

Result is 6

script write by ECMAScript 2015:
var lines = "line 1\nline 2\nline 3\nline 4\nline 5\n";
Remark: you need to use ` (the symbol next the number 1 on keyboard)

Reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

No comments :

Post a Comment