How do you include JavaScript in an HTML file?
By using the <script> tag.
What is the purpose of onclick in HTML?
is an HTML attribute used to define JavaScript code to execute when an element is clicked.
What are some common arithmetic operations in programming?
include addition (+), subtraction (-), multiplication (*), and division (/).
What is the purpose of the else statement in JavaScript?
The else statement provides an alternative set of instructions to be executed if the condition in the if statement is false.
How do you create a horizontal line in HTML?
By using the <hr> (horizontal rule) tag.
What does HTML stand for?
Hyper Text Markup Language
What does innerHTML do in JavaScript?
innerHTML is a property in JavaScript used to get or set the HTML content of an element.
What is the return statement used for in a function?
The return statement specifies the value to be returned by the function after its execution.
How can we define and initialize a variable in JavaScript?
let / var can be used to define a variable, let counter = 0, to initialize.
How do you create a heading in HTML?
By using the <h1> to <h6> tags for different levels of headings.
How do you access an element in the HTML document using its ID in JavaScript?
By using document.getElementById('id').
Name some basic data types in JavaScript.
Numbers, Strings, Booleans, Null, Undefined, Objects, Symbols (ES6).
How do you create a function with a counter in JavaScript?
By using a global variable as a counter and updating its value within the function each time it's called.
How do you declare and initialize an array in JavaScript?
const myArray = [item1, item2, item3];
How do you create a numbered list in HTML?
By using the <ol> (ordered list) tag with <li> (list item) tags.
What does document.write do in JavaScript?
to write content directly to the HTML document.
What is the purpose of a conditional statement in programming?
allows the program to make decisions based on specified conditions.
How do you create a bullet list in HTML?
By using the <ul> (unordered list) tag with <li> (list item) tags.
What is a function in programming?
a block of code that performs a specific task and can be reused multiple times.
How do you change the background color of an HTML element using JavaScript?
style.backgroundColor
What do style.fontSize and style.display control in JavaScript?
style.fontSize controls the font size of an element, and style.display controls whether an element is displayed or hidden.
What are the basic types of conditional statements in JavaScript?
The basic types are if, else if, and else.
What is the purpose of the <input> tag in HTML?
The <input> tag is used to create input fields for forms, such as text fields, buttons, checkboxes
How do you define a function in JavaScript?
By using the function keyword followed by a name
How do you hide an HTML element using JavaScript?
By setting the element's style.display property to "none"