Working with Strings

Video

JavaScript Notes

JavaScript
    'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String'

    // All about Strings
    
    var str1 = new String("Toy Story"); 
    var str2 = String("Wall E");
    var str3 = "Cars";
    
    var result = str1.toUpperCase();
    var result2 = "Monsters Inc".toLowerCase();
    
    var r1 = str2.substring(4, 5); // returns ‘-‘ 
    var r2 = str2.substr(4, 1);  // returns ‘-‘ 
    var r3 = str2.slice(4, 1); // returns ‘-‘
    var r4 = str2.indexOf("-"); // returns 4
    var r5 = str1.lastIndexOf("o"); // returns 6
    var r6 = "".concat(str1, ", ", str2, ", ", str3); // concatenates strings with spaces