Chapter 16. Going Further with JavaScript
This chapter covers various concepts that can help make you a better JavaScript programmer. You don’t need most of the ideas here to write functioning JavaScript programs, so don’t worry if you don’t understand them all. The first few sections provide helpful tips and methods for working with strings, numbers, and dates, and once you’ve mastered the basics, these sections can really help you process visitor input in forms, work with HTML and HTML attributes, and generate dates for calendars. The section Putting It All Together contains some good advice for beginners, but you can program happily for a long time without needing the information in the other sections in this chapter. But if you want to expand your skills, this chapter can point you in the right direction.
Working with Strings
Strings are the most common type of data you’ll work with: input from form fields, the path to an image, a URL, and HTML that you wish to replace on a page are all examples of the letters, symbols, and numbers that make up strings. You learned the basics of strings in Chapter 2, but JavaScript provides a lot of useful methods for working with and manipulating strings.
Determining the Length of a String
There are times when you want to know how many characters are in a string. For example, say you want to make sure that when someone creates an account on your top secret website, they create a new password that’s more than 6 letters but no more than 15. Strings ...
Get JavaScript & jQuery: The Missing Manual, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.