Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript Function

Total questions: 8

Worksheet time: 4mins

Name
Class
Date
1.

What is a JavaScript function?

a)

A type of variable

b)

A set of instructions that performs a specific task

c)

A data structure used to store multiple values

d)

An operator that performs arithmetic operations

2.

What is the keyword used to define a function in JavaScript?

a)

const

b)

define

c)

def

d)

function

3.

What is a function parameter?

a)

The value returned by the function

b)

The name of the function

c)

An input passed to the function when it is called

d)

A variable used to store the function's output

4.

What is the syntax for calling a function in JavaScript?

a)

functionName(argument1, argument2)

b)

function(argument1, argument2) = functionName

c)

functionName {argument1, argument2}

d)

functionName.argument1(argument2)

5.

What is the purpose of a return statement in a function?

a)

To define the function

b)

To call the function

c)

To specify the value to be returned by the function

d)

To declare a new variable inside the function

6.

How can you pass multiple parameters to a function in JavaScript?

a)

Separate them with a space

b)

Separate them with a period

c)

Separate them with a comma

d)

Separate them with a semicolon

7.

What is the difference between a function declaration and a function expression?

a)

There is no difference

b)

A function declaration can be called before it is defined

c)

A function expression can be called before it is defined

d)

A function expression is defined using the "this" keyword

8.

Can a function in JavaScript have no parameters?

a)

Yes

b)

No