JavaScript
Though JavaScript is more than two decades old, for much of its history it was primarily used as a scripting language for webpages. Along with HTML, a markup language, and CSS, a style sheet language, it formed the holy trinity of frontend development. HTML provided the scaffolding for webpages, CSS styled those elements, and JavaScript made them dynamic. If a webpage is a building, HTML forms the bones, CSS the paint and drywall, and JavaScript the electricity and plumbing. (Eghbal 2020, p. 35)
JavaScript is a dynamically-typed scripting language. Though JavaScript’s syntax is based on Java (and thus resembles C), the similarities are largely superficial. All major web browsers support JavaScript to enable interactive web pages. This lesson introduces JavaScript and client-side input validation.
Learning Objectives
- Describe the uses and limitations of JavaScript
- Implement simple functions using JavaScript
- Perform client-side validation of user input
How to Complete this Lesson
Complete the following learning activities: (2.75–3.5 hours total)
- Read JavaScript basics (15–30 minutes)
- Attend the class meeting
(60 minutes)
- Review the JavaScript examples (15 minutes)
- Complete the exercises using regular expressions (15 minutes)
- Optional: Watch “Wat” (5 minutes)
- Work on the web development programming exercise (PEX)
(90–120 minutes)
- Create the required web pages (introduction, service partners, and volunteer information) with the specified static content
Resources
- HTML/JS: Making webpages interactive
- Get ready to make your webpages interactive (10 minutes)
- JS and the DOM (20 minutes)
- DOM access methods (30 minutes)
- DOM modification (30 minutes)
- DOM events (35 minutes)
- Using JS libraries in your webpage (10 minutes)
- Client-side form validation (15–30 minutes)