Search Header Logo

KA JS Arrays

Computers

KG - University

Used 157+ times

KA JS Arrays
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of these lines of code show how to validly store an array with 3 items?

var nums = [42, 3, 7];
var nums = 3, 42, 7;
var nums = [3];
var nums = (3, 42, 7);

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How would you access the second element in an array?

nums.2
nums[2]
nums_1
nums[1]

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How would you change the first element in an array?

nums[1] = "New!";
nums = "New!";
var nums[1] = "New!";
nums[0] = "New!";

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What property tells you how many items are in an array?

length
count
items
num

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method can you use to add an element to an array in JavaScript?

pop()
push()
append()
insert()

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of these for loops would iterate through each item of the nums array (no more, no less)?

for (var i = 0; i < nums; i++) { }
for (var i = 1; i < nums.length; i++) { }
for (var i = 1; i < nums; i++) { }
for (var i = 0; i < nums.length; i++) { }

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?