1 / 6

Javascript Errors and Debugging

Javascript Errors and Debugging. Web Design Sec 6-3. Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials. Objectives. The student will: Be able to tell when Javascript has triggered an error in your web browser

kasie
Télécharger la présentation

Javascript Errors and Debugging

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JavascriptErrors and Debugging Web Design Sec 6-3 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials

  2. Objectives • The student will: • Be able to tell when Javascript has triggered an error in your web browser • Have gained practice understanding Javascript error messages and applying them toward correcting errors in Javascript code

  3. Finding Bugs in JavaScript • If your JavaScript doesn't work as you expected it to, that might mean you have a bug in your code.  • Typos are a common source of bugs in JavaScript. If your script isn't working, check the following: • Missing punctuation. Be sure every opening bracket has an accompanying closing bracket. • Unclosed character string. Whenever you're working with text in JavaScript (for example, when you displayed text in an alert box in the previous lesson), that text must be enclosed in quotation marks. You can use either single quotation marks ('...') or double quotation marks ("...") but be sure every opening quotation mark is closed at the end of the string of characters.

  4. Finding Bugs in JavaScript • Misspelled variable. JavaScript is case-sensitive. In the example in the previous lesson, you created a variable called myText. That isn't the same as MyText; one has a lower-case M, the other does not. If you define a variable called myText, then try to execute the command alert(MyText) the script would fail because MyText doesn't exist.

  5. Summary • Debugging is the art of finding bugs in your code, and fixing them • Look carefully at all the opening and closing brackets and quotes, then check all the spelling.

  6. Rest of Today • Download the homework for today. • There is a Google form in which you are to identify the three errors in the code. • Complete this today!

More Related