JavaScript Introduction: Student Guide

In addition to HTML and CSS, JavaScript represents one of the main tools web developers use to create rich, responsive w

180 27 196KB

English Pages 273 Year 2023

Report DMCA / Copyright

DOWNLOAD FILE

JavaScript Introduction: Student Guide

Table of contents :
Cover Page
JavaScript Introduction
Lesson 1: Introduction to JavaScript
Versions of JavaScript
Creating your first JavaScript page
Scripting Terminology
Expression
Variable
Operators
Statement
Language Fundamentals
Declaring Variables
Assigning or Setting Variables
Case Sensitive
Spacing and Ending Statements
Comments
Data Types
Numeric Variables
String Variables
Boolean Variables
Other Basic Data Types
Built-in Objects
Math
Date
User input methods
Lesson 2: JavaScript Conditions
Conditional Constructs
The if Construct
Testing Multiple Conditions
Exercise 2-1 Using the if construct
The switch Construct
Exercise 2-2 Using the switch
The Conditional (Ternary) Operator
Exercise 2-3 Using the ternary operator
Lesson 3: JavaScript Loops
JavaScript Loops
The while Loop
JavaScript Labels and Branch Statements
Lesson 4: Primitive Data Types
The String Data Type
String Properties
String Methods
The Number Data Type
Number Properties
Number Methods
Global Functions Used with Numbers
Lesson 5: Compound Data Types
Arrays
Storing Data in Arrays
Array Properties
Looping Over an Array
Exercise 5-1 Holding data in an array
Array Mutator Methods
Array Accessor Methods
Multidimensional Arrays
Objects
Storing Data in an Object
Accessing Data in an Object
Looping Through Data in an Object
Creating an Object Method
Creating an Object Constructor
Arrays of Objects
Exercise 5-3 Working with objects
Using JSON Syntax to Store Data
JSON.parse()
JSON.stringify()
Lesson 6: Functions
Declaring and Invoking a Named Function
Returning Values
Creating an Anonymous Function Expression
Scope
Local and Global Variables
Function Scope
Function Arguments
Setting Default Arguments
The arguments and this Properties
Lesson 7: Regular Expressions
Constructing a Regular Expression
Creating a Pattern
Using Parentheses to Match Substrings
Applying Regular Expression Methods
Regular Expression Method exec()
Regular Expression Method test()
Using Regular Expressions in String Methods
String Method match()
String Method search()
String Method replace()
String Method split()
Backreferences
Lesson 8: The Browser Object Model
The Browser Object Model
The history Object
The location Object
The screen Object
The console Object
The window Object's open() and close()Methods
Using BOM Methods to Execute Code
setTimeout()/clearTimeout()
setInterval()/clearInterval()
Lesson 9: The Document Object Model
The Document Object Model API
The document Object
The document Object Access Methods
Using Selectors to Access Elements
Working with DOM Nodes
Creating Nodes with the DOM
Manipulating CSS with the DOM
Lesson 10: Event Handling
The event Object
Event Handling
Traditional Event Registration
Registering With addEventListener()
Removing the Event Listener
Types of Events
Mouse Events
Keyboard Events
Clipboard Events
Window Events
Form Events
Event Methods
stopPropagation();
preventDefault()
Exercise 10-1 Using events
Lesson 11: Debugging and best practices
JavaScript Coding Styles
Variable and Statement Coding Styles
Block Coding Styles
JavaScript Best Practices
Optimizing Code Performance
The "use strict"; Directive
The JavaScript debugger; Statement
Custom Error Handling
Lesson 12: Working with forms
Validating Form Data with JavaScript
Form Events
Checking for Empty Fields
Testing for String Length
Making Sure a Selection is Made
Testing whether the user has checked a box
Data Validation with Regular Expressions
Index

Polecaj historie