/
Strings Introduction to JavaScript Strings Introduction to JavaScript

Strings Introduction to JavaScript - PowerPoint Presentation

marina-yarberry
marina-yarberry . @marina-yarberry
Follow
368 views
Uploaded On 2018-02-19

Strings Introduction to JavaScript - PPT Presentation

Copyright 2016 Fred McClurg All Rights Reserved 2 String Examples What is a string A series of characters between double or single quotation marks Examples This is a string double quotes ID: 633110

quotes string double single string quotes single double html examples quoted escaped console strings character line log long quoteswhat

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Strings Introduction to JavaScript" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Strings

Introduction to JavaScript

© Copyright

2016,

Fred McClurg All Rights ReservedSlide2

2String ExamplesWhat is a string?A series of characters between double or single quotation marks.Examples:"This is a string"; // double quotes'Also a string'; // single quotes"12"; // string not a number'Not a string"; // mismatched (error!)"Also not string'; // mismatched (error!)strings.htmlSlide3

3Quotes within QuotesWhat is a string?A string containing double quotes can be quoted using single quotes. A string containing single quotes can be quoted using double quotes.Examples:// double within single quotes'single "quoted" string';// single within double quotes"double 'quoted' string";quotesInQuotes.htmlSlide4

4Escaping QuotesWhat is an escaped quote?Single and double quotes (and other special characters) can be escaped using the backslash “\” character.Examples:// double quotes escaped"Today's word is \"perspicacious\"";// single quote escaped'Today\'s word is "perspicacious"';escapingQuotes.htmlSlide5

5Concatenating StringsWhat is string concatenation?The plus “+” symbol is used to join strings together.Examples:// long string concatenatedvar conCat = "God whispers to us " + "in our pleasures ... " + "but shouts in our " + "pains. -- C.S. Lewis";console.log( conCat );

concatStr.htmlSlide6

6String Type ConversionWhat is string type conversion?The plus “+” symbol is also used to convert numbers to the equivalent string.Examples:var count = 0; // integer// number is converted to stringvar message = "Yes we have " + count + " bananas";console.log( message );

strTypeConvert.htmlSlide7

7Line ContinuationWhat is line continuation?A long line can span multiple lines via the backslash “\” character as the last character on the line.Examples:// spanning lines via continuationvar strCont = "The remarkable thing is, \we have a choice everyday regarding the \attitude we will embrace for that day. \-- Chuck Swindoll";console.log( strCont

);

lineCont.html