JavaScript Introduction Terms Flashcards
Basic terms, defining variables, strings, booleans, operators, etc.
What is JavaScript?
It is a programming language that powers the dynamic behavior on most websites. Alongside HTML and CSS, it is a core technology that makes the web run.
What are Methods?
Methods return information about an object and are called by appending an instance with a period “.”, the method name, and parentheses. Example: Math.random(); // Returns a number between 0 and 1
What is a console.log()?
The console.log() method is used to log or print messages to the console. It can also be used to print objects and other info.
What is String Concatenation?
In JavaScript, multiple strings can be concatenated together using the “+” operator.
What is an Assignment Operator?
An assignment operator assigns a value to its left operand based on the value of its right operand.
What is the addition assignment operator?
+=
What is the subtraction assignment operator?
-=
What is the multiplication assignment operator?
*=
What is the division assignment operator?
/=
What is String Interpolation?
It is the process of evaluating string literals containing one or more placeholders (expressions, variables, etc). It can be performed using template literals: “text ${expression} text”. “‘Tommy is ${age} years old.’;”
What are Variables?
A variable is a container for data that is stored in computer memory. It is referenced by a descriptive name that a programmer can call to assign a specific value and retrieve it.
What does Undefined mean?
“undefined” is a primitive JavaScript value that represents lack of defined value. Variables that are declared but not initialized to a value will have the value “undefined”.
How do you declare a variable?
To declare a variable in JavaScript, any of these keywords can be used along with a variable name: var, let, and const.
When is the variable “var” used?
“var” is used in pre-ES6 versions of JavaScript.
When is the variable “let” used?
“let” is the preferred way to declare a variable when it can be reassigned. A “let” variable will contain “undefined” if nothing is assigned to it.