this keyword, DOM events, event loop, and floating point numbers. They are all just weird!
Because there are a lot of weird things in JS, I consider it important to get to know JS. Take JS out on a date in essence. What makes JS tick? What are the internal workings of it? Why so dynamic? Maybe even get a callback number…
So I admit, I probably should be learning more and more about JS each day. So here, I just learned this bit about JS today!
What JS is doing does make sense, it’s just weird. The key to understanding this code bit is order of precedence and truthy values. I’ll break down the first comparison then the last.
1 < 2 evaluates to
true. Then the first expression turns into
true < 3, which then evaluates to
true. What’s going on is that
true has an implicit numerical value of
1 < 3 is true of course.
Similar thing happens with the last one.
3 > 2 is true, then the next expression evaluates to
true > 1. That last expression is then
false, because what is really being compared is
1 > 1. That is just plain
Limiting my learning to JS may be a little foolish. I can definitely expand my learning to what cool things people make in JS! Or even start learning other languages! For example, I’ve been picking up Rust! Low level programming concepts fill my head sometimes, so I would have to take a break. So I could start learning another language, or just make sure my current skills are prime. There are some cool things I have seen done in JS and CSS that I have not replicated.
I would like to repeat the quote on the landing page of this site.
“The only people who achieve much are those who want knowledge so badly that they seek it while the conditions are still unfavorable.”
So I even need to learn when conditions are unfavorable. I may not have put this into practice as much as I could. There are very comfortable conditions to learn. Maybe I can mention one occasion. I was in an coding assignment I didn’t want to be in. So I made a point to to learn the things I knew I should be learning if I wanted my dream progression. That time period proved to be a good learning time for me. So then could I still achieve that same learning value when things are comfortable? I’ll have to put that in perspective. Or just keep putting myself in uncomfortable positions where I am forced to learn.