In this chapter, the following content will be discussed: JS Strings, JS numbers, javascript operators, javascript math object, javascript dates, javascript booleans, javascript comparison and logical operators, javascript statements, javascript loop statements ( for, while, do/while), javascript best practices. | CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad Virtual Campus, CIIT COMSATS Institute of Information Technology T3-Lecture-2 JavaScript Part-III T2-Lecture-08 T2-Lecture-7 Ahmed Mumtaz Mustehsan 1- Objectives JS Strings (contd ) JS Numbers JavaScript Operators JavaScript Math Object JavaScript Dates JavaScript Booleans JavaScript Comparison and Logical Operators JavaScript Statements JavaScript loop statements ( for, while, do/while) JavaScript Best Practices T2-Lecture-7 Ahmed Mumtaz Mustehsan Replacing Content The replace() method replaces a specified value with another value in a string: Example str = "Please visit Microsoft!" var n = ("Microsoft","W3Schools"); The replace() method can also take a regular expression as the search value. T2-Lecture-7 Ahmed Mumtaz Mustehsan 1- Convert to Upper Case A string is converted to upper case with the method toUpperCase(): Example var txt = "Hello World!"; // String // txt1 is txt converted to upper var txt1 = (); T2-Lecture-7 Ahmed Mumtaz Mustehsan 1- Convert to Lower Case A string is converted to lower case with the method toLowerCase(): Example var txt = "Hello World!"; // String // txt1 is txt converted to lower var txt1 = (); T2-Lecture-7 Ahmed Mumtaz Mustehsan 1- Convert a String to an Array A string is converted to an array with the built in method (): Example var txt = "a,b,c,d,e" // String (","); // Split on commas (" "); // Split on spaces ("|"); // Split on pipe T2-Lecture-7 Ahmed Mumtaz Mustehsan 1- Special Characters In JavaScript, strings are written as characters inside single or double quotes. JavaScript will misunderstand this string: "We are the so-called "Vikings" from the . | CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad Virtual Campus, CIIT COMSATS Institute of Information Technology T3-Lecture-2 JavaScript Part-III T2-Lecture-08 T2-Lecture-7 Ahmed Mumtaz Mustehsan 1- Objectives JS Strings (contd ) JS Numbers JavaScript Operators JavaScript Math Object JavaScript Dates JavaScript Booleans JavaScript Comparison and Logical Operators JavaScript Statements JavaScript loop statements ( for, while, do/while) JavaScript Best Practices T2-Lecture-7 Ahmed Mumtaz Mustehsan Replacing Content The replace() method replaces a specified value with another value in a string: Example str = "Please visit Microsoft!" var n = ("Microsoft","W3Schools"); The replace() method can also take a regular expression as the search value. T2-Lecture-7 Ahmed Mumtaz Mustehsan 1- Convert to Upper Case A string is converted to upper case with the method toUpperCase(): .