Handling Text Strings

Line Breaks and Contractions

Text Strings

When writing a text string you place your text within single quotations.

var cat = ‘The cat is on the porch’;

Line breaks \n

To create line breaks within a text string use \n. This slash is above the enter key. NOT the slash on the question mark key. Do not put spaces before and after the \n unless you want a space in your text string.

var cat = ‘The cat is on the porch.\nThe dog is in the backyard.’;

slash N


Since you are using single quotations to create your text string, this makes contractions tricky. Place a slash in front of the apostrophe.

var cat = ‘The cat\’s are on the porch.’;

slash apostrophe

Leave a Reply

Your email address will not be published. Required fields are marked *