Primitive Types
- Number
- String
- Boolean
- Null
- Undefined
- Symbol
- BigInt
JavaScript Numbers
- JavaScript has ONE number type
- Math operations
- add : +
- subtraction : -
- multiplication : *
- division : /
- modulo(remainder operator) : %
- exponentiation : **
NaN
- "Not a Number"
- NaN is a numeric value that represents something that is not a number.
- ex) 0/0, 1+NaN
Variables
- Labels for values
- Basic Syntax
- let x = value;
- ex) let year = 1956;
Updating Variables
- +=, -=, *=, /= operations
//EXAMPLES
//These two operations are exactly the same.
score = score+5;
score += 5;
- ++, -- operations
- add/subtract 1
Const & Var
- const
- stands for constant
- The value can't be changed.
- var
- The old variable keyword.
- Before let&const, var was the only option. There isn't really a reason to use it now.
Booleans
- value: true, false
Variable Naming and Conventions
- Hard Rules for Naming
- No space allowed within the name.
- Can't start with number.
- Best Practices
- Camel Cased : If there are more than one word for the name, start the first one with lowercase and others with uppercase.
- Use recognizable names.
* This post is a summary of Udemy Course "The Web Developer Bootcamp" by Colt Steele.
'TIL: Today I Learned' 카테고리의 다른 글
[TIL] 20201127 JavaScript Decision making (0) | 2020.11.27 |
---|---|
[TIL] 20201126 JavaScript Strings and More (0) | 2020.11.27 |
[TIL] 20201124 CSS Frameworks: Bootstrap (0) | 2020.11.24 |
[TIL] 20201123 Responsive CSS & Flexbox (0) | 2020.11.23 |
[TIL] 20201121 Other Assorted Useful CSS Properties (0) | 2020.11.21 |