- Programming content overview
- Tracking progress of programming students
- Classroom debugging guide
- Pair programming in the classroom
- Teaching guide: Intro to JS - Drawing Basics
- Teaching guide: Intro to JS - Coloring
- Teaching guide: Intro to JS - Variables
- Teaching guide: Intro to JS - Animation basics
- Teaching guide: Intro to JS - Interactive Programs
- Teaching guide: Intro to JS - Resizing with variable expressions
- Teaching guide: Intro to JS - Text and strings
- Teaching guide: Intro to JS - Functions
- Teaching guide: Intro to JS - Logic and if statements
- Teaching guide: Intro to JS - Looping
- Teaching guide: Intro to JS - Arrays
- Teaching guide: Intro to JS - Objects
- Teaching guide: Intro to JS - Object-oriented design
- Programming classroom handouts
- Additional programming projects
- Lesson plans: teaching programming in the classroom
- Programming case study: Encouraging cross-disciplinary projects
- Programming case study: Going beyond the KA curriculum
- Programming case study: Teaching an elementary school class
What the student will learn
- How to create arrays to store a sequence of values in one variable.
- How to access or change elements of an array using “bracket notation”.
- How to add elements to an array using the push() method.
- How to iterate through an array using a for loop.
The student will be able to write code like:
Where students struggle
- Students take time to get used to the fact that arrays start at index 0, since we’re used to counting from 1 in our every day life. Keep reminding them about that.
- If students didn’t get comfortable using
forloops in the last lesson, they will likely struggle to use them in this lesson. If that’s the case, they may want to re-watch the
forloop lesson and go through the challenge again.
- When iterating with a
forloop, students often forget to use bracket notation to access the elements of their array, and they instead access the whole array. Ask them whether their code is truly accessing only one element of the array.
- Students may wonder if there is a method for removing elements from an array. They can use the
pop()method for that. There are in fact many array methods we don’t teach in the intro course, which students can find by searching the web for “JS array methods”.
- Students may wonder if they can create a 2-d array, to store a grid of values. They can certainly do that, but we don't teach that in the intro course. Search for “multi-dimensional JS array” or “2-d JS array” for examples.
Additional materials: Discussion questions
These are questions that you can ask students individually after they've done the lesson, or lead a group discussion around, if everyone's gotten to the same point.
- What data would be useful to store in an array? Open a popular game or an app for inspiration, and have the students brainstorm.
Additional materials: Trivia questions
These can be fun to do as a class after everyone’s gotten through the lesson. They can also lead to discussion about which questions are the hardest. Play them on Quizizz.