on-internet
← Community

How can I remove indentation from multiline strings?

Stack Overflow ·

According to this esdiscuss discussion, it is possible in ECMAScript 6 to define multiline strings without having to place subsequent lines of the string at the very beginning of the line. Allen Wirfs-Brock’s post contains a code example: var a = dontIndent `This is a template string. Even though each line is indented to keep the code neat and tidy, the white space used to indent is not in the resulting string`; Could someone explain how this can be achieved? How to define this dontIndent thing in order to remove the whitespace used for indentation?

Comments

Sign in or sign up to comment and upvote.

No comments yet.