Skip to main content
Forgot the new line… :)
Source Link
Chiru
  • 584
  • 3
  • 11

Prefer template string new lines over "\n"

This will start to pay off at even a single new line character in your code. One use case might be:

(16 bytes)

array.join("\n")

(15 bytes)

array.join(`
`)

Update: You can even leave away the braces due to tagged template strings (thanks, edc65!):

(13 bytes)

array.join`
`

Prefer template string new lines over "\n"

This will start to pay off at even a single new line character in your code. One use case might be:

(16 bytes)

array.join("\n")

(15 bytes)

array.join(`
`)

Prefer template string new lines over "\n"

This will start to pay off at even a single new line character in your code. One use case might be:

(16 bytes)

array.join("\n")

(15 bytes)

array.join(`
`)

Update: You can even leave away the braces due to tagged template strings (thanks, edc65!):

(13 bytes)

array.join`
`
Source Link
Chiru
  • 584
  • 3
  • 11

Prefer template string new lines over "\n"

This will start to pay off at even a single new line character in your code. One use case might be:

(16 bytes)

array.join("\n")

(15 bytes)

array.join(`
`)