Review and Pursue
- How do you declare a variable?
- What is variable scope?
- What are the rules for a variable’s name?
- What is the assignment operator?
- What simple types were introduced in this chapter?
- How can you use a single quotation mark within a string? A double quotation mark?
- What does the *= operator do? How about +=? (There are two answers to this last question.) And what about ++?
- What operator can cause bugs when used with a string and a number together?
- What does the toFixed() method do?
- What are some of the differences between Number objects and the Math object?
- What is an empty string?
- What does the charAt() method do? What does indexOf() do? How about lastIndexOf()? What are the arguments to the indexOf() and lastIndexOf() methods? What happens when you use negative numbers for the second argument to either method?
- What function should you use to pull a substring out of a string and how do you use it?
- What are the various ways you can perform concatenation with strings?
- What are escape sequences?
- What are some of the ways you can convert a string to a number?
- Use a development tool such as Firebug to practice creating and manipulating variables.
- If you’re curious, find out what “hoisting” is.
- Create another calculator, such as one that calculates the area of a shape (rectangle, triangle, circle, etc.).
- Look online (e.g., at https://developer.mozilla.org) to research all the Number and Math object properties and methods.
- Look online to learn more about the String object and its methods.
- Create another string manipulation example.
- Test all of this chapter’s code in as many browsers and devices as you can to see the various results.