web_development:js:js-strings

Javascript Strings

/********************************
 * String Values
 * 1.2.5.1
 *
 *******************************/

// var username = 'zgordon';

// console.log( username );




/********************************
 * String Values with Missing
 * Quotation Marks
 * 1.2.5.2
 *
 *******************************/

// var username = 'zgordon';

// console.log( username );





/********************************
 * String Values 
 * 1.2.5.3
 *
 *******************************/

// var title = 'Hello JavaScript!';

// var content = 'Lorem to the Ipsum';





/********************************
 * String Concatenation
 * 1.2.5.4
 *
 *******************************/

// var title = 'Hello JavaScript!';

// var content = 'Lorem ' + ' ipsum';

// var post = title + " - " + content;

// console.log( post );




/********************************
 * Variables at the Top
 * 1.2.5.5
 *
 *******************************/


// var title = 'Hello JavaScript!',
//     content = 'Lorem ' + 'ipsum',
//     post;

// post = title + " - " + content;

// console.log( post );





/********************************
 * String Methods
 * 1.2.5.6
 *
 *******************************/


// var title = 'Hello, my world!',
//     content = 'Lorem',
//     spacey = ' username ';

// console.log( title.charAt( 1 ) );
// console.log( title.slice( 0, -1 ) );
// console.log( title.slice( 2 ) );
// console.log( content.concat( ' ', title ) );
// console.log( spacey.trim() );
  • web_development/js/js-strings.txt
  • Last modified: 2020/09/18 01:45
  • by jimboobrien