Q: What is JavaScript?
A: JavaScript is a programming language used to make web pages interactive.
Q: What are some basic data types in JavaScript?
A: Some basic data types in JavaScript include strings, numbers, booleans, arrays, and objects.
Q: How do you declare a variable in JavaScript?
A: You can declare a variable using the 'var', 'let', or 'const' keyword.
Q: What is the difference between 'let' and 'const'?
A: The 'let' keyword allows you to declare a variable that can be reassigned, while the 'const' keyword is used for variables that should not be reassigned.
Q: How do you write comments in JavaScript?
A: You can write single-line comments using //, or multi-line comments using /* ... */.
Q: What is a function in JavaScript?
A: A function is a block of code that performs a specific task. It can be reused and called multiple times.
Q: What is an if statement?
A: An if statement is used to make decisions in JavaScript. It evaluates a condition and executes a block of code if the condition is true.
Q: What is a loop in JavaScript?
A: A loop is used to repeatedly execute a block of code. JavaScript provides different types of loops, such as 'for', 'while', and 'do...while'.