SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
In just 24 lessons of one hour or less, Sams Teach Yourself JavaScript in 24 Hours helps you learn the fundamentals of web programming using the JavaScript language.
Designed for beginners with no previous programming experience, this book’s straightforward, step-by-step approach shows you how to use JavaScript to add a wide array of interactive features and effects to your web pages.
Every lesson builds on what you’ve already learned, giving you a rock-solid foundation for real-world success.
Step-by-step instructions carefully walk you through the most common JavaScript programming tasks.
Practical, hands-on examples show you how to apply what you learn.
Quizzes and exercises help you test your knowledge and stretch your skills.
Learn how to…
· Use JavaScript to build dynamic, interactive web pages
· Debug scripts
· Create scripts that work in all browsers
· Write clear, reliable, and reusable code
· Use object-oriented programming techniques
· Script with the DOM
· Manipulate JSON data
· Work with HTML5 and CSS3
· Control CSS with simple JavaScript code
· Read and write cookies
· Use some of the new ECMAScript features today
· Match patterns using regular expressions
· Understand and use closures
· Organize your code with modules
Download the sample pages (includes Chapter 10)
Introduction 1
Part I: Your First Steps with JavaScript
LESSON 1: Introducing JavaScript
Web Scripting Fundamentals
Summary
Q&A
Workshop
Exercises
LESSON 2: Writing Simple Scripts
Including JavaScript in Your Web Page
Writing JavaScript Statements
Using Variables
Working with Operators
Capturing Mouse Events
Summary
Q&A
Workshop
Exercises
LESSON 3: Introducing Functions
General Syntax
Calling Functions
Summary
Q&A
Workshop
Exercises
LESSON 4: More Fun with Functions
Scope of Variables
Arrow Functions
Setting Default Parameters
Summary
Q&A
Workshop
Exercise
LESSON 5: DOM Objects and Built-in Objects
Interacting with the User
Selecting Elements by Their ID
Accessing Browser History
Using the location Object
Using Dates and Times
Summary
Q&A
Workshop
Exercises
Part II: Cooking with Code
LESSON 6: Dealing with Numbers
Numbers
Global Methods
The Number Object
The Number() Function
Boolean Values
The values null and undefined
Summary
Q&A
Workshop
Exercise
LESSON 7: Working with Character Strings
Strings
Template Strings
Summary
Q&A
Workshop
Exercise
LESSON 8: Storing Data In Arrays
Arrays
How to Iterate Through Arrays
The Three-Dots Operator
Summary
Q&A
Workshop
Exercises
LESSON 9: Handling Events in JavaScript
Types of Events
Event Handlers
The event object
Summary
Q&A
Workshop
Exercises
LESSON 10: Controlling Program Flow
Conditional Statements
Loops and Control Structures
How to Set and Use Timers
Summary
Q&A
Workshop
Exercises
Part III: Understanding JavaScript Objects
LESSON 11: Introducing Object-Oriented Programming
What Is Object-Oriented Programming?
Object Creation
Extending and Inheriting Objects Using prototype
Encapsulation
Summary
Q&A
Workshop
Exercises
LESSON 12: Learning More About Objects
Classes
Object Inheritance
Feature Detection
Summary
Q&A
Workshop
Exercise
LESSON 13: Scripting with the DOM
DOM Nodes
Selecting Elements with getElementsByTagName()
How to Read an Element’s Attributes
Mozilla’s DOM Inspector
Summary
Q&A
Workshop
Exercises
LESSON 14: Meet JSON
What Is JSON?
How to Access JSON Data
Data Serialization with JSON
JSON Data Types
How to Simulate Associative Arrays
How to Create Objects with JSON
JSON Security
Summary
Q&A
Workshop
Exercises
Part IV: Manipulating Web Pages with JavaScript
LESSON 15: Programming HTML with JavaScript
Markup for HTML5
Some Important Elements
Drag and Drop
Local Storage
How to Work with Local Files
Summary
Q&A
Workshop
Exercises
LESSON 16: Manipulating CSS in JavaScript
A Ten-Minute CSS Primer
The DOM style Property
How to Access Classes Using className
The DOM styleSheets Object
Summary
Q&A
Workshop
Exercises
LESSON 17: More Advanced Control of CSS
Vendor-Specific Properties and Prefixes
CSS3 Borders
CSS3 Backgrounds
CSS3 Gradients
CSS3 Text Effects
CSS3 Transitions, Transformations, and Animations
How to Reference CSS3 Properties in JavaScript
How to Set CSS3 Properties with Vendor Prefixes
Summary
Q&A
Workshop
Exercises
Part V: Some Advanced Techniques for Your JavaScript Toolkit
LESSON 18: Reading and Writing Cookies
What Are Cookies?
Using the document.cookie Property
Reviewing Cookie Ingredients
Writing a Cookie
Writing a Function to Write a Cookie
Reading a Cookie
Deleting Cookies
Setting Multiple Values in a Single Cookie
Summary
Q&A
Workshop
Exercises
LESSON 19: Matching Patterns Using Regular Expressions
Creating a Regular Expression
Summary
Q&A
Workshop
Exercises
LESSON 20: Understanding and Using Closures
Revisiting Scope
Returning a Function from a Function
Achieving Closure
Summary
Q&A
Workshop
Exercise
LESSON 21: Organizing Code with Modules
Why Use Modules?
Module Basics
Exporting
Importing
Summary
Q&A
Workshop
Exercise
Part VI: Learning the Trade
LESSON 22: Good Coding Practice
Don’t Overuse JavaScript
How to Write Readable and Maintainable Code
Graceful Degradation
Progressive Enhancement
Unobtrusive JavaScript
Feature Detection
How to Handle Errors Well
Summary
Q&A
Workshop
Exercises
LESSON 23: Debugging Your Code
An Introduction to Debugging
More Advanced Debugging
Summary
Q&A
Workshop
Exercise
LESSON 24: Where to Go Next
Why Use a Library?
What Sorts of Things Can Libraries Do?
Some Popular Libraries and Frameworks
A Closer Look at jQuery
The jQuery UI
An Introduction to Ajax
How to Use jQuery to Implement Ajax
A Brief Look at Node.js
Summary
Q&A
Workshop
Exercises
APPENDIX A: Tools for JavaScript Development
Editors
Validators
Verifying and Testing Tools
9780672338090 TOC 8/8/2018