Multi-line JavaScript

I discovered via some random blog post that you can do multi-line JavaScript by escaping the line breaks.

var a = ‘You can start here \
and continue here \
and then finish it up here.’;

The backslash on each line allows you to keep going. It’s a little bit cleaner than opening and closing quotes and a concatenation operator on each line.

http://snook.ca/archives/javascript/multi-line-javascript

One thought on “Multi-line JavaScript

  1. Hi there Dear, are you really visiting this web page on a regular basis,
    if so then you will without doubt take nice know-how.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s