JavaScript has tpye coercion which basically means if you use an operator like -, *, /, or % (but not +) it attempts to convert the values into numbers.
E.g. “1423” - “41” => Convert both strings to numbers (1423 - 41) and then calculate (1423 - 41 = 1382)
+ is special that it allows concatenation of strings like “cat” + “dog” = “catdog”
Using operators for any real strings other than + will result in NaN (Not a Number) value being returned.
Shorthand operators like += or *=:
Instead of having to write something like let count = 0, and then count = count + 2, you can just use count += 2
Comparing two string values like:
“a” > “y” = false
It’s basically backwards to our inituition, where we think of “a” in the first position so in a way it’s larger.
It just boils down to the first letter “a” is assigned a Unicode decimal value of 97 (whereas “A” is 65).
So “a” = 97 and “y” = 121 => 97 > 121 = false
Expressions vs statements:
Generally speaking, if you see declarative keywords such as let, for, if, etc it’s a statement;
Expressions is the content inside of statements, like 5 + 3.
E.g. let y = (5 + 3) is a statement, that contains the expression 5 + 3
Square braces vs curly braces: Generally, just think square = array, and curly = everything else.
There’s more to it of course but for now we’ll stick with that
Unicode characters — for security reasons. Be very careful when determining non-ASCII characters such as “é” is it can either “\u{e9}” or “e\u{301}“. Both are different but look indistinguishable! This is known as a homograph attack
What I did
I thought I’d write down my thoughts and things that I learn.
Thought about how I’d methodically return to my previous study journals to either reincorporate that content, or at least review it.
Probably assigning a number to each entry, and then using a random number generator to locate a study journal to review.