Please enable JavaScript to use CodeHS

Teaching AP CS Principles with JavaScript

Description

In this lesson, students learn about lists/arrays and how to access an element in an array with an index so they can create ordered collections of items and use them in their programs.

Objective

Students will be able to:

  • Define an array
  • Access certain elements of an array by using an index
Description

In this lesson, students continue to work with array indexing to get and assign array values so they can incorporate arrays/lists into their programs and handle data more efficiently.

Objective

Students will be able to:

  • Use indexing to call and assign items in an array
Description

In this lesson, students learn how to add and remove elements at the end of an array using the push and pop methods.

Objective

Students will be able to:

  • Add elements at the end of an array using the push method
  • Remove elements from the end of an array using the pop method
Description

In this lesson, students will be able to get the length of an array and learn how to loop through an array so they can have more functionality with arrays in their programs.

Objective

Students will be able to:

  • Determine the length of an array using the length property
  • Use the length of an array and a for loop to loop through the elements in an array
  • Loop over an array to filter or print certain elements based on tested criteria
Description

In this lesson, students will be able to get the length of an array and loop through an array so they can use arrays in problems involving random numbers and JavaScript graphics.

Objective

Students will be able to:

  • Use the length of an array and a for loop to loop through the elements in an array
  • Loop over an array to filter or print certain elements based on tested criteria
  • Using iteration on arrays for problems involving randomness and graphics
Description

In this lesson, students learn and use another method on a list, indexOf in order to find elements in lists within their programs.

Objective

Students will be able to:

  • Use the indexOf method to find the index of a particular element in an array.
Description

In this lesson, students will learn how to use the splice and remove methods to remove an element from an array to add more functionality to their programs.

Objective

Students will be able to:

  • Use the splice and remove methods to remove an element from an array.
Description

We learn what simulations are, how they are used, and we simulate gravity and Conway’s Game of Life.