wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JS-QUIZ

Total questions: 25

Worksheet time: 18mins

Name
Class
Date
1.

Which keyword is used to declare a variable in JavaScript?

a)

var

b)

let

c)

const

d)

All of the above

2.

What does typeof null return?

a)

null

b)

object

c)

undefined

d)

string

3.

Which method is used to convert a string into an array?



a)

arrayify()

b)

slice()

c)

join()

d)

split()

4.

How do you write a single-line comment in JavaScript?

a)

// comment

b)

<!-- comment -->

c)

/* comment */

d)

# comment

5.

What will 2 + "2" evaluate to in JavaScript?

a)

4

b)

22

c)

undefined

d)

NaN

6.

Which function is used to parse a string into an integer?

a)

parseInt()

b)

parseFloat()

c)

Number()

d)

toInt()

7.

What does NaN stand for?

a)

No Argument Needed

b)

Not a Number

c)

Number at Null

d)

Non-Accessible Node

8.

Which loop always executes at least once?

a)

for

b)

while

c)

do...while

d)

None

9.

What is the output of console.log(0.1 + 0.2 === 0.3)?

a)

true

b)

false

c)

undefined

d)

NaN

10.

What is the correct way to declare a function in JavaScript?

a)

function myFunc() {}

b)

def myFunc() {}

c)

let myFunc = {}

d)

create function myFunc() {}

11.

How can you check if a variable is an array?

a)

isArray(variable)

b)

Array.check(variable)

c)

Array.isArray(variable)

d)

typeof variable === "array"

12.

Which operator is used to compare both value and type?

a)

=

b)

==

c)

===

d)

!=

13.

What will console.log("5" - 3) output?


a)

a) 2

b)

b) 53

c)

c) NaN

d)

d) undefined

14.

Which method adds an element to the end of an array?

a)

push()

b)

pop()

c)

shift()

d)

unshift()

15.

What is the result of console.log(typeof undefined)?



a)

a) null

b)

b) object

c)

c) undefined

d)

d) string

16.

How do you declare a constant in JavaScript?

a)

let

b)

const

c)

var

d)

define

17.

Which method is used to convert JSON to a JavaScript object?

a)

JSON.parse()

b)

JSON.stringify()

c)

JSON.convert()

d)

JSON.objectify()

18.

What will be the output of the following code?

let x; console.log(x);

a)

null

b)

undefined

c)

Error

d)

0

19.

Which of the following is NOT a primitive data type in JavaScript?

a)

string

b)

number

c)

object

d)

boolean

20.

How do you write an arrow function in JavaScript?

a)

let myFunc = => () {}

b)

let myFunc = function => {}

c)

let myFunc = () => {}

d)

let myFunc => () {}

21.

console.log("🎉".repeat(3));

a)

🎉🎉🎉

b)

Error

c)

🎉3

d)

undefined

22.

Write a function called addNumbers that takes two parameters and returns their sum

4 lines
23.

How much do you enjoy working with JavaScript?

a)

🎉 I love it! The possibilities are endless!

b)

🤔 It's okay, but sometimes it drives me crazy.

c)

😓 I struggle with it, but I’m learning.

d)

💤 Not my favorite, but I manage.

24.

Where do you currently find yourself in terms of JavaScript proficiency?

a)

🚀 Advanced – I can build complex projects and solve tricky problems with ease!

b)

🌱 Just Starting – I’ve just begun my journey with JavaScript and am exploring the language.

c)

📚 Beginner – I’m still learning the basics and practicing simple tasks.

d)

🔧 Intermediate – I understand the fundamentals well and can build small to medium-sized projects.

25.

Draw a shape you like! : ) just 4 fun