HTML stands for this
What is Hyper Text Markup Language
The keyword used to create a new variable
What is var
Name 3 simple data types.
Strings, number, boolean.
What is the purpose of a function in javascript?
A function is used to encapsulate a block of code that performs a specific task and can be reused throughout the program.
What does the if statement do in JavaScript?
It executes a block of code if the specified condition is true.
What does CSS stand for?
Cascading Style Sheets
How do you create an unorderlist in HTML ?
<ul>
<li><li>
<li><li>
<ul>
Identify the data types of the following variables
name is a string, age is a number, and canDrive is a boolean
What value is the result of the following code?
6 == '6'
true
How do you call a function named myFunction in JavaScript?
myFunction();
How do you write an if statement that checks if a variable x is greater than 10?
How do you select an element with the class name "header" in CSS?
.header
What attribute specifies the destination URL in an anchor tag?
href attribute
What is the result of this code?
50 is printed to the console
What's 5 + '5'?
'55' or string concatenation
What will be the output of the following code?
function add(a, b) {
return a + b;
}
console.log(add(7, 9));
What is the purpose of the else statement?
It provides an alternative block of code to execute if the if condition is false.
What property is used to change the text color in CSS?
Color property.
Is an image tag a self closing or does it require a closing forward slash?
Self-closing.
What symbol is used for concatenation of strings in JavaScript?
The + symbol.
You are given a number called n.
What do we know about n if (n % 2 === 0) is true?
It is an even number
How can you invoke a function named calculateSum that accepts three parameters, passing the values 2, 3, and 5?
calculateSum(2,3,5);
How would you write a conditional statement that checks if a variable age is less than 18 and logs "Minor"?
if (age < 18) {
console.log("Minor");
}
Create a CSS class called "hidden" that sets the display property to none.
.hidden {
display: none;
}
What does the alt attribute in an image tag do?
It provides alternative text for the image.
What is the naming convention used for naming variables / How does it work?
Camel Case. The first letter is lowercase and every other word after is uppercase.
var x = 5;
var y = 2;
var z = 3 * 1 * 5;
var youTellMe = (z === x * y + 5)
What is the value of youTellMe?
true
How do you code a function, what's required?
function funcName () { }
function funcName (num1, num2) {
return num1 + num2}
Write an if-else statement that checks if a number num is positive, negative, or zero and logs the appropriate message.
if (num > 0) {
console.log("Positive number");
} else if (num < 0) {
console.log("Negative number");
} else {
console.log("Zero");
}
Write a CSS rule to make all <h1> elements have a font size of 24px and a color of red.
h1 {
font-size: 24px;
color: red;
}