Font size
WorksheetsReview - Programming in JavaScript
Total questions: 20
Worksheet time: 14mins
What would be the correct way to call a function?
function printPig();
printPig
Print Pig ();
printPig();
console.log involves . . .
asking a question
printing a message
creating a function
calculating a math problem
Ask for a number
let number = readLine
let number = readInteger
let number = readInt
readInt
What would be the correct way to define a function?
function create a fox
function createAFox()
createAFox();
What is the difference between calling and defining a function?
Calling a function is when you give a function a name.
Defining a function is when you determine what is inside that function.
Defining a function is when you determine what a function does.
Calling a function is when you want to use a defined function in your program.
Calling a function is when you determine what a function does.
Defining a function is when you want to use a called function in your program.
Reorder the following to print a message:
console
.
log
("My favorite marvel character is Spiderman.")
;
stores information:
variables
javaScript
user input
functions
Why do we write functions? (select all that apply)
To make our code easier to understand by giving a readable name to a group of instructions
To avoid writing repeated code
To make our code reusable
What keyword do you need to use to define a variable in JavaScript?
variable
var
let
console.log
What is printed to the screen in the program below?
let hobby = "bird watching";
console.log("I like to go " + hobby);
I like to go bird watching
I like to go hobby
I like to go + hobby
“I like to go ” + hobby
Which of the options below is a correct way to declare a variable and assign it a value?
let number = 9;
let number = readInt ("Give me a number.");
let = 9
What function do you need to call to ask the user of the program to enter text?
readText()
readInt()
readline()
readLine()
True or False: the function readInt is asking the user for a number
True
False
True or False:
Calling a function is more work than defining a function
True
False
Which of the words below are Key words? (Select all that apply)
Ask
Calculate
console.log
let
Using User Input, ask the user for their name:
(a)
Using User Input, ask the user for a number.
(a)
Using JavaScript, print this message: Ms. Silverman's birthday is on January 21!
(a)
Using javaScript, create a multiplication problem to calculate the total cost using the variables price and books
(a)
This code appears at the end of your program and if you delete this, then your function will run but nothing will appear on the screen
function main()
main();
