Skip to content
Advertisement

Multi line string with arguments. How to declare?

Let’s say I have an extremely long string with arguments that I want to create. I know you can create a multiline string with

JavaScript

But now lets say I want to pass 1, 2, and 3 as arguments.

This works

JavaScript

But if I have a super long string with 30+ arguments, how can I possibly pass those arguments in multiple lines? Passing them in a single line defeats the purpose of even trying to create a multiline string.

Thanks to anyone in advance for their help and insight.

Advertisement

Answer

You could abuse the line continuation properties of the parenthesis ( and the comma ,.

JavaScript
Advertisement