Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Fundamentals of JavaScript

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the correct syntax to declare a variable in JavaScript?

a)

let x = 5;

b)

let x == 5;

c)

var x = 5;

d)

const x : 5;

2.

Which of the following is a JavaScript data type?

a)

boolean

b)

integer

c)

string

d)

undefined

3.

What does 'NaN' stand for in JavaScript?

a)

Number-Not-Available

b)

Not-a-Name

c)

Null-Value

d)

Not-a-Number

4.

How do you create a function in JavaScript?

a)

function:myFunction() { // function body }

b)

function myFunction: { // function body }

c)

function myFunction() { // function body } or const myFunction = () => { // function body }

d)

myFunction() => { // function body }

5.

What is the purpose of the 'this' keyword in JavaScript?

a)

The 'this' keyword is used to refer to the current execution context or object.

b)

The 'this' keyword is used to create new objects in JavaScript.

c)

The 'this' keyword is a function that returns the current date.

d)

The 'this' keyword is used to declare variables in JavaScript.

6.

How can you add a comment in JavaScript?

a)

Use // for single-line comments and /* comment */ for multi-line comments.

b)

Use # for comments

c)

Use for comments

d)

Use // for multi-line comments only

7.

What is the difference between '==' and '===' in JavaScript?

a)

The difference is that '==' performs type coercion while '===' does not.

b)

Both '==' and '===' perform type coercion.

c)

'==' checks for strict equality while '===' checks for loose equality.

d)

'==' and '===' are interchangeable operators.

8.

Where is the correct place to insert a JavaScript?

a)

The <head> section

b)

The <body> section

c)

both the <head> and <body> section are correct

9.

Inside which HTML element do we put the JavaScript?

a)

<script>

b)

<javaScript>

c)

<js>

d)

<scripting>

10.

What is the value of:

”41” + 1

a)

42

b)

“42”

c)

411

d)

“411”