JavaScript Functions and Objects Lecture 12 PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document is a JavaScript lecture on functions and objects, specifically focusing on string manipulation methods. It includes various methods like "charAt", "charCodeAt", "split", etc., demonstrating how to manipulate strings in JavaScript. The lecture also covers HTML elements like “BIG” and “B”.
Full Transcript
lecture 12:JavaScript functions and Objects continue Methods Manipulating the contents of the String Object var myStr = "Let's see what happens!"; Method Example Returned value charAt myStr.charAt(0) L charCodeAt...
lecture 12:JavaScript functions and Objects continue Methods Manipulating the contents of the String Object var myStr = "Let's see what happens!"; Method Example Returned value charAt myStr.charAt(0) L charCodeAt myStr.charCodeAt(12) 97// unicode of a=97 split myStr.split(“ “,3) ["Let's", "see", "what"] indexOf myStr.indexOf("at") 12 lastIndexOf myStr.lastIndexOf("a") 16 substring myStr.substring(0, 7) Let's s concat myStr.concat(“ now”); Let's see what happens! now myStr.replace(/e/,”?”) L?t's see what happens! replace myStr.replace(/e/g,”?”); L?t's s?? what happ?ns! Methods Manipulating the appearance of the String Object Name Example Returned value big “hi".big() hi bold "hi".bold() hi