O'Reilly logo

JavaScript & jQuery: The Missing Manual, 3rd Edition by David Sawyer McFarland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required