wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

js_edu_wrap_up

Total questions: 20

Worksheet time: 13mins

Name
Class
Date
1.

What will this code do?

a)

Throw a ReferenceError

b)

Print "orange"

c)

Print "undefined"

2.

Which value is falsy?

a)

'false'

b)

[]

c)

{}

d)

``

e)

new Boolean(false)

3.

What is the result of this code?

'2' > '12'

a)

TypeError

b)

true

c)

false

d)

NaN

4.

What will this code print?

a)

Jack

b)

Daniel

c)

undefined

d)

ReferenceError

5.

What will this code print?

a)

0

b)

1

c)

2

6.

What is the result of this code?

((...x, y) => x)(1, 2, 3)

a)

[1, 2, 3]

b)

[1, 2]

c)

1

d)

SyntaxError

7.

What is the result of this code?

['a', 'b', 'c'][3]

a)

'c'

b)

undefined

c)

ReferenceError

d)

'a'

8.

What is the result of this code?

['', 0, null].indexOf(false)

a)

0

b)

1

c)

2

d)

-1

9.

What is the result of this code?

[15, 1, 2].sort()

a)

[1, 2, 15]

b)

['1', '2', '15']

c)

[1, 15, 2]

d)

['1', '15', '2']

10.

What is the result of the following code?

[0, 1, 2, 3].some(v => v % 2 === 0)

a)

0

b)

[0, 2]

c)

true

d)

false

11.

What will this code print?

a)

"Oh noes!" and "The fails!"

b)

"Oh noes!"

c)

"That fails"

d)

"actually that worked"

e)

nothing

12.

What will the following code print?

a)

hello

world

b)

world

hello

c)

world

d)

undefined

world

13.

What will this code do?

a)

Prints "hello"

b)

SyntaxError

c)

Nothing

14.

The order in which nested DOM elements receive the same event from the innermost element to the outermost element is called ________

a)

capturing

b)

bubbling

15.

In a click event listener of a link, which function can cancel the browser's navigation to its URL?

a)

preventDefault

b)

stopPropagation

c)

removeEventListener

16.

Which call adds element ele between divs div1 and div2?

a)

div1.appendChild(ele)

b)

div2.parentNode.

appendChild(ele)

c)

div2.parentNode.

insertBefore(ele, div2)

17.

What will this code do?

(Date has a getFullYear method.)

a)

Fails to compile

b)

Prints TypeError

c)

Prints "2022"

18.

Which features do TypeScript add on top of JavaScript? (Select all correct answers.)

a)

classes

b)

enums

c)

generics

d)

optional typing

e)

unions

19.

What will this code print?

a)

"a is 47"

b)

"a is 0"

c)

"a is "

d)

None of the above

20.

What will this code do?

a)

Fails to compile

b)

Warns about implicit cast

c)

Prints "1"