Course Hero Logo

Chapter 02 Slides.pptx - Chapter 2 Get started fast with...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 9 out of 62 pages.

Chapter 2Get started fastwith JavaScriptMurach's JavaScript & jQuery (4th Ed)© 2020, Mike Murach & Associates, Inc.C2, Slide 1
Objectives (part 1)Applied1.Given the specifications for a JavaScript application that requiresonly the skills that you’ve learned so far, code, test, and debug theapplication.Knowledge2.Describe two ways to include JavaScript in the body of an HTMLdocument.3.Describe how case-sensitivity, semicolons, and whitespace relate tothe syntax for a JavaScript statement.4.List the primary rules for creating a JavaScript identifier.5.Describe the use of JavaScript comments, including “commentingout” portions of JavaScript code.Murach's JavaScript & jQuery (4th Ed)© 2020, Mike Murach & Associates, Inc.C2, Slide 2
Objectives (part 2)5.Describe these three primitive data types that are available fromJavaScript: numeric, string, and Boolean.6.Describe the use of variable and constant declarations andassignment statements with numeric, string, and Boolean data.7.Distinguish between using theletandconstkeywords to declareconstants and variables and using thevarkeyword to declarevariables and constants.8.Describe the use of the arithmetic operators and the rules forevaluating an arithmetic expression, including order of precedenceand the use of parentheses.9.Distinguish between using the + operator and a template stringliteral when working with strings.10.Explain how to use an escape sequence such as \n to include aspecial character in a string.Murach's JavaScript & jQuery (4th Ed)© 2020, Mike Murach & Associates, Inc.C2, Slide 3
Objectives (part 3)11.Describe the syntax for referring to a method or property of anobject.12.Describe the use of the alert(), prompt(), parseInt(), parseFloat(),write(), and toFixed() methods.Murach's JavaScript & jQuery (4th Ed)© 2020, Mike Murach & Associates, Inc.C2, Slide 4
Two attributes of the script elementsrctypeA script element in the body sectionthat loads an external JavaScript file<body>...<script src="calculate_mpg.js"></script></body>Murach's JavaScript & jQuery (4th Ed)© 2020, Mike Murach & Associates, Inc.C2, Slide 5
A script element that embeds JavaScriptin the body section<body>...<script>alert("The Calculate MPG application");let miles = prompt("Enter miles driven");miles = parseInt(miles);let gallons =prompt("Enter gallons of gas used");gallons = parseInt(gallons);let mpg = miles/gallons;mpg = parseFloat(mpg);alert("Miles per gallon = " + mpg);</script></body>Murach's JavaScript & jQuery (4th Ed)© 2020, Mike Murach & Associates, Inc.C2, Slide 6
Terms related to including JavaScriptexternal JavaScript fileembedded JavaScriptMurach's JavaScript & jQuery (4th Ed)© 2020, Mike Murach & Associates, Inc.C2, Slide 7
An HTML page with two noscript elements<body><header><h1>Welcome to my website!</h1><noscript><h2>To get the most from this website, pleaseenable JavaScript in your browser.</h2></noscript></header><!-- main HTML for page goes here --><footer><script>const today = new Date();document.write(`Today is ${today.toDateString()}.`);</script><noscript>Today is the first day of the rest of your life.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 62 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
Freeman
Tags
Regular expression, Mike Murach

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture