wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

How to get access to number 8 in the following array?

const arr = [[1, 2, 3], [[5, 6, 7, 8], 9]]

a)

arr[[[1,0,3]]]

b)

arr[1][0][3]

c)

arr[1,0,3]

d)

arr[1[0[3]]

2.

What would be the result of this?

const a = 20;

a = 10;

console.log(a)

a)

10

b)

20

c)

it would throw an error

d)

undefined

3.

function getSum(a, b) {

console.log(a + b);

}

const result = getSum(10, 20);

console.log(result);

a)

30

b)

undefined

c)

0

d)

10

4.

What does map function return?

a)

undefined

b)

number

c)

string

d)

array

5.

How to access property name on the object?

const country = {

name: 'Italy',

population: 59550000

};

a)

country,name

b)

country.name

c)

country['name']

d)

country{name}

6.

What would the following comparison produce?

2 == "2"

a)

true

b)

false

c)

undefined

d)

error

7.

Guess the result of this:

{foo: 'bar'} === {foo: 'bar'}

a)

true

b)

false

c)

I haven't learned it yet!

d)

undefined

8.

How to convert number n to string?

a)

n+''

b)

n.toString()

c)

toString(n)

d)

String(n)

9.

How many arguments does function foo accept?

const foo = (array, fn) => fn(array)

a)

0

b)

1

c)

2

10.

What would be the result of the following?

var arr = [1,2,3];

console.log(arr[0]);

a)

1

b)

2

c)

3

d)

undefined