Home > Sample chapters > Programming > HTML, JavaScript and web development

Working with Variables and Data Types in JavaScript

  • 6/15/2013

Exercises

  1. Declare three variables—one number and two strings. The number should be 120, and the strings should be “5150” and “Two Hundred Thirty”.

  2. Create a new array with three numbers and two strings or words.

  3. Use the alert() function to display the following string, properly escaped: Steve’s response was “Cool!”

  4. Use Internet Explorer to examine three of your favorite websites, and debug the errors using Interne Explorer tools. Look closely for any JavaScript errors reported. Bonus: Try using Firebug to examine those same three websites.