Reading JavaScript** -- Explain and provide examples for: ~ Basic Literal Types: null. Intentionally empty value. 1 value. null+1 => 1 null-1 => -1 1/null => Infinity
Boolean
. 2 possible values. true/false.
Boolean(3>4)
=> false
Boolean(3/5)
=> true
Boolean("less">"much more")
=> false
Number
.Multiple values. Whole numbers are integers. In JavaScript all numbers are decimals.
Number(5)
=> 5
5*7
=> 35
3+4
=> 7
String
. Multiple values. It is a sequence of characters or data type. It is enclosed in quotes.
"my secret closed"
=> 'my secret closed'
Boolean("string")
=> true
"I "+"like "+"my class"
=> 'I like my class'
~ Basic Operators: Arithmetic. (+ addit.,- subt.,* multip.,/ divis.,% remain).They can be used with number and + with strings (concatenation) 3+3 => 6 27/6 => 4.5 34%27 => 7
Comparison. (== equal,!= not equal,>bigger,< smaller,>=bigger or equal,<= smaller or equal,!==not precisely equal,=== precisely equal) 4!=4 => false Boolean("magic"==='magic') => true
Assignment. =. It assigns values to a labels. var food="apples" food => 'apples' var drink="lemonade" drink => 'lemonade' food+drink => 'appleslemonade
~ Built-in Constants: undefined. Absence of a meaningful value.
NaN
. Not a Number. It has no meaningful result.
food/drink
=> NaN
Infinity-Infinity
=> NaN
0/0
=> NaN
Infinity
.Numbers with no end. Unlimited number of characters.
any number / 0 gives you Infinity