What are variables in JavaScript?
- Variables in JavaScript are containers used to store data values so you can use and change them later in your program.
What does it mean to declare a variable?
can be used in 4 ways:
- Modern JavaScript- Using let; Using const
- Old JavaScript- Older JavaScript
Using var (Not Recommended)
Automatically (Not Recommended)
What is an “assignment” operator, and what does it do?
- An assignment operator in JavaScript is a type of binary operator that assigns a value to its left operand based on the value of its right operand [1]. It essentially takes the value on the right (the source) and puts it into the variable or property on the left (the destination)
- Information received from the user is called input.
Explanation:
Input is any data a user provides to a program, such as:
-
Text typed into a form
-
Button clicks
-
Choices or selections
Values entered into prompts
Example
let name = prompt(“What is your name?”);