SitePoint
  • Premium
  • Library
  • Community
  • Jobs
  • Blog
LoginStart Free Trial
Learn to Code with JavaScript
Learn to Code with JavaScript
Notice of Rights
Notice of Liability
Trademark Notice
About Darren Jones
About SitePoint
Preface
Who Should Read This Book?
Conventions Used
Supplementary Materials

1

Press Start

Programming
A Brief History of Programming
JavaScript
Hello, World! Your First JavaScript Program
JavaScript in the Browser
I Can Code a Rainbow: Your Second JavaScript Program
A Programmer’s Mindset
Challenges
Summary
Comments
Programming Grammar
Variables
Pop-up Interaction
Challenges
Summary
Chars and Strings
Template Literals
Challenges
Summary
Integers and Floats
Numeric Literals
Exponential Notation
When Is a Number Not a Number?
Arithmetic Operations
Varying Variables
Increments
How Old?
Calculations with Numbers and Strings
Converting Between Strings and Numbers
Random Numbers
More Methods
Challenges
Summary
Arrays
Arrays in JavaScript
Multi-dimensional Arrays
Challenges
Summary
Booleans
Logical Operators
Comparison
Flow Control
What’s Your Favorite Animal?
Rock Paper Scissors
Challenges
Summary
What’s a Loop?
Infinite Loops
While Loops
Do–while Loops
For Loops
Nested Loops
Challenges
Summary
Functions in JavaScript
Return Values
Parameters and Arguments
Callbacks
Choosing the Right Type of Function
Challenges
Summary
Properties and Methods
Creating Objects in JavaScript
Properties and Methods
Roll the Dice
Challenges
Summary
The Document Object Model
Getting an Element
Updating the HTML
Getting Multiple Elements
Navigating the DOM Tree
Creating Dynamic Markup
Getting and Setting Attributes
Doing It with Style
A Simple To-do List
Challenges
Summary
Event-based Programming
Click Events
Forms
Keyboard Events
Mouse Events
Simple To-do List
Challenges
Summary
Spreading Strings
Array Iteration Methods
Find
Every
Iterating over Objects
To-do List Project
Challenges
Summary
Named Parameters
The Rest Parameter
Recursive Functions
Scope
Hoisting
Functions That Return Functions
Closures
Functional Programming
Pure Array Updates
Challenges
Summary
Copying Objects in JavaScript
Object-oriented Programming
Classes
Classy Components
The Pet Unicorn Game
Challenges
Summary
The UNIX Epoch
Times and Dates
Timing Functions
Asynchronous Programming
Intervals
Animation
Cookie Grabber Game
Challenges
Summary
Coding Best Practice
Going Further with JavaScript
Learn Another Language
Always Learning
Carry On Coding
Internet of Things
Challenges
Summary

The Main Event

Unlock This Title

You do not have access to this section. Get the full version of this title with a Free SitePoint Account.

Start Free TrialRead Free Preview

Already have an account? Sign In

Community Questions