wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

IP: JavaScript & jQuery

Total questions: 9

Worksheet time: 5mins

Name
Class
Date
1.

In JavaScript, how would I declare a constant myName?

a)

constant myName = "Michael Phelps";

b)

var myName = "Michael Phelps";

c)

const MyName = "Captain Sparrow";

d)

const myName = "Princess Buttercup";

2.

How do I declare a variable named weekDay and set it to "Tuesday"?

a)

weekDay = "Tuesday";

b)

let weekDay = "Tuesday";

c)

const weekDay = "Tuesday";

d)

WeekDay = "Tuesday";

3.

Which of the options below should replace ??? if we wish to sprint on the console "Gonna get coal" when the variable naughty is true?


if (???) {

console.log("Gonna get coal");

} else {

console.log("Lots of presents!");

}

(a)  

4.

In JavaScript, how do I call myFunction()?

a)

myFunction();

b)

myFunction;

c)

call myFunction();

d)

call function myFunction();

5.

Select one or more of the following answers to this question: Why are functions useful in JavaScript?

a)

I can give a function any name I want.

b)

Descriptive function names help programmers to understand the program design.

c)

Any function can be called by from any other place in your code (code reuse).

d)

A function gathers together a group of code to perform a particular task and gives it a name.

6.

In JavaScript, what symbolizes "is equal to"?

a)

=

b)

!=

c)

===

d)

==

7.

What does the jQuery statement $(document).ready() do?

a)

It moves the <script> to the end of the HTML page.

b)

It starts the script immediately.

c)

It waits until the browser has finished downloading the web page to begin executing.

8.

Select one or more of the following statements to answer this question: What is jQuery?

a)

A JavaScript library

b)

It contains dynamic behavior functions

c)

It Implements drawing functions

9.

In JavaScript, what are 2 differences between variables and constants?

a)

Variables may be used in an If-else statement; constants cannot.

b)

Constants must be set when they are declared; variables can be set later.

c)

Variables can be changed; constants cannot be changed.

d)

Constants can be changed; variables cannot be changed