NEW
Font size
WorksheetsJavaScript Basics Review
Total questions: 20
Worksheet time: 16mins
Where does JavaScript code go in an HTML document?
<script> tag
<html> tag
<style> tag
<button> tag
How can a developer show a pop-up message to the user?
alert
prompt
console.log
<p> tag
Which of the following will successfully display a message to the user?
Alert(Hello, user);
alert("Hello, " user);
Alert("Hello, user");
alert("Hello, user");
Which of the following will successfully display a message to the user?
alert("hello, " + "user");
Alert("hello, " + user);
alert("hello", + "user");
alert("Hello, " + user";
What does this line of code do?
Declares AND sets a variable
Declares a variable
Sets a variable
Adds a value to a variable
Which is NOT necessary when setting a variable?
variable name
equals sign
value to set the variable to
"var" keyword
Which message will the user see?
"I think you want a Sword I think"
Depends what they answer
"you want a Sword I think"
"thinkingMessage + messageToShow + thinkingMessage"
What's the data type for the phoneNumber variable?
String
Number
What's the data type for the ageInput variable?
String
Number
What's the data type for the age variable?
String
Number
What's the value of the ageCalc variable?
"19.27"
26.2
"25.7"
19.27
What attribute/value do we use to make a button execute JavaScript when clicked?
onclick="doSomething;"
on-click="doSomething;"
onclick="doSomething();"
onclick=doSomething();
How do you make a button in HTML?
<button>Text</button>
<button text="Text"></button>
<button>Text<button>
<button Text>
What is the syntax to declare a function called doSomething?
function doSomething() { }
doSomething() function { }
function () doSomething { }
doSomething { } function ()
