Font size
WorksheetsJS Loops and Functions
Total questions: 10
Worksheet time: 6mins
What is a function in JavaScript?
A function in JavaScript is a type of variable.
A function in JavaScript is a method for creating objects.
A function in JavaScript is a data structure that holds values.
A function in JavaScript is a reusable block of code that performs a specific task.
How do you call a function in JavaScript?
function call()
call functionName
invoke functionName()
functionName()
A loop that executes for a pre-defined number of times
(a)
A loop that executes until a condition is met is called
(a)
for ( var i = 0; i < 50; i++ )
How many times will this loop execute
51 times
49 times
50 times
0 times
Which of the iterations runs 25 times
for ( var i = 2; i < 26; i ++ )
for ( var i = 0; i < 25; i ++ )
for ( var i = -1 ; i > 25 ; i -- )
for ( var i = 0; i <= 25; i --)
Given the following code, what is the final value of x?
var x = 0;
function myXFunction() {
x = x + 10;
}
x = x + 1;
11
0
10
1
What code will result in the above?
alert("Please enter your phone number:")
confirm("Please enter your phone number:")
prompt("Please enter your phone number:")
What is the syntax for creating a function in JavaScript named as Geekfunc?
A) function = Geekfunc()
B) function Geekfunc()
C) function := Geekfunc()
D) function : Geekfunc()
What is the name of this function?
function
spin()
3 turnLeft();
spin();
