lesson 2 codecademy Flashcards
variable
A variable can be thought of as a label that points to the location of a specific piece of data. Variables are not the values that is stored inside of them
Data Types
the classifications we give to the different kinds of data that we use in programming. In JavaScript, there are seven fundamental data types:
Number, String, Boolean, Null, Undefined, Symbol, and Object
Number
any number, including numbers with decimals
String
any grouping of characters on your keyboard surrounded by single quotes or double quotes, though we prefer single quotes.
Boolean
This data type only has two possible values: true or false. It’s helpful to think of booleans as on and off switches.
Null
represents the intentional absence of a value, and is represented by the keyword null.
Undefined
represents the absence of a value though it has a different use than null. undefined means that a given value does not exist
Symbol
a newer feature to the language, symbols are unique identifiers, useful in more complex coding,
Object
Collections of related data.
Arithmetic Operators
An operator is a character that performs a task in our code. They allow us to perform mathematical calculations on numbers.
String Concatenation
The process of appending one string to another.
ex: console.log(‘hi’+’ya’); //Prints ‘hiya’
Properties
All data types have access to specific properties that are passed down to each instance. You can retrieve property information by appending the string with a period and the property name
ex: Every string instance has a property called length that stores the number of characters in that string. console.log(‘Hello’.length); //Prints 5
Methods
actions we can perform. Data types have access to specific methods that allow us to handle instances of that data type.
The rules for naming variables
Variable names cannot start with numbers.
Variable names are case sensitive, so myName and myname would be different variables.
Variable names cannot be the same as keywords.
An if statement
checks a condition and will execute a task if that condition evaluates to true.