NEW
Font size
WorksheetsJavaScript Basics Quiz
Total questions: 10
Worksheet time: 5mins
What does the println() function do in JavaScript?
Moves Karel forward
Prints text or output to the console
Creates a new variable
Clears the screen
What will this code output? println("Hello"); println("World");
Hello World (on one line)
Hello (on one line) and World (on next line)
HelloWorld
Error
What happens if you forget the quotation marks in: println(Hello);
It prints Hello
It prints nothing
It causes an error
It repeats forever
What is the correct way to create a variable in JavaScript?
var = name "Jeremy";
var name = "Jeremy";
variable name = "Jeremy";
name var = "Jeremy";
What is a variable?
A fixed number that never changes
A command that prints text
A box that holds a value
A loop that repeats a task
Which of the following is a valid variable name?
8ball
my var
numApples
VarName
What type of variable would store the value "Hello"?
Number
Boolean
String
Float
What is the value of numApples after this code runs? var numApples = 5; numApples = 0;
5
0
undefined
error
Why is it important to use descriptive variable names?
Makes code easier to read and understand
Makes the program run faster
Helps println work correctly
Required by CodeHS
What do both Karel and JavaScript programs have in common?
They use println()
They both use commands inside a function
They both move Karel
They don’t need syntax
