click below
click below
Normal Size Small Size show me how
Vidcode Module 7-1
Question | Answer |
---|---|
What does the following code do? var newstring = str.toUpperCase(); | This code would change the string named "newstring" to all uppercase letters. |
What does the following code do? var newstring = upped.replace(/O/g, "T"); | This code would change any "o" or "g" in the string to a "T." |
Explain the following code: movie.whenMouseClicked = function() { if (my_input.message != "") { var str = my_input.message; var upped = str.toUpperCase(); var smilified = upped.replace(/O/g, "😀"); my_text.message = smilified; } | First, this code will execute when the mouse is clicked. Then, the code checks to see if the message is empty. Next, it assigns "str" to my_input.message. Next, the code changes the message to upper case, then the code looks to see if there are specific letters and if they are, those letters are replaced. Last, the string is reassignment to my_text.message. |