1 of 9

Unit 5

Lesson 2 Lists Investigate

2 of 9

To do: December 8

Copy these key words in Unit 5 IN glossary.

Unit 5 Lesson 3 - Warm Up

List -

Element -

Index -

an ordered collection of elements

an individual value in a list that is assigned a unique index

a common method for referencing the elements in a list or string using numbers

Array -

a data structure in JavaScript used to represent a list.

3 of 9

Warm-up

1. What is the output of the following code segment?

var strListOne = ["x", "y", "z", "3"];

console.log(strListOne[1] + strListOne[2]);

2. What is the output of the following code segment?

var strListTwo = ["x", "y", "5", "z"];

insertItem(strListTwo, 2, "d");

console.log(strListTwo[2] + strListTwo[3]);

4 of 9

Warm-up

3. What is the output of the following code segment?

var strListThree = ["x", "y", "z"];

appendItem(strListThree, "t");

removeItem(strListThree, 2);

console.log(strListThree.length + " " + strListThree[2]);

4. What is the output of the following code segment?

var myArray = [1,2,4,7,8,10];

var n = myArray[myArray.length-1];

console.log(n);

5 of 9

Using list.length-1 to access last item in array

var myArray = [1,2,4,7,8,10];�var last = myArray[myArray.length-1];�console.log(last);

>> 10

6 of 9

Go over homework

  • goFormative U5L01 Lists Explore
  • AP Classroom Programming Practice part 1
  • Code.org 2019-20 Unit 3 Lesson 7 Bubble 10 - using a function with a parameter

7 of 9

goFormative U5L02 Lists Investigate

Log into Code.org Unit 5 Lesson 2 bubble 2

8 of 9

AP Classroom 2021 Test REVIEW 3-2 Unit 4 programming

9 of 9

Homework

  • Copy 4 Unit 5 key words in IN and submit image/pdf
  • Complete goFormative 05L02 Lists Investigate
  • AP Classroom 2021 Test REVIEW 3-2 Unit 4 programming
    • complete online and show work for each problem
    • submit work to Hub