I have learned a lot by coming to your channel. Thanks a lot for it!
@chesterxp5082 жыл бұрын
Another very cool tutorial!
@serhii1134 жыл бұрын
Thanks! A couple of nuances ;) +{} // NaN +[1] // 1 +[1,2] // NaN "If an object has no primitive value, valueOf returns the object itself." (c) MDN
@SteveGriffith-Prof3ssorSt3v34 жыл бұрын
I've updated my code Gist to reflect the two Array differences for +[1] and +[1,2]. The Arrays get turned into the Primitive string values "1" and "1,2" before being converted to Numbers which is why we get the 1 and NaN results. Not sure why I had 0 written for the Objects. They will always be NaN. Thanks for pointing it out.
@rmnkot4 жыл бұрын
Very important core knowledge! Thanks, as always!
@SteveGriffith-Prof3ssorSt3v34 жыл бұрын
My pleasure!
@Robert-cw9ev4 жыл бұрын
Thanks for video! I've also looked at other explanations on internet and I found out that: - "" to number is 0; - [] to number is 0, because it first converts to string which is "", then it converts "" to number which is 0; - "" == 0 its true. So equals operator converts both to number, which means that "" to number is 0.
@BrendanMetcalfe4 жыл бұрын
Looks like you put in a lot of work on this! Good work man
@katherineprokofieva57073 жыл бұрын
thanks for your video!
@joaovaz34734 жыл бұрын
Great video, always! A question: isn't an empty array a falsy value?
@SteveGriffith-Prof3ssorSt3v34 жыл бұрын
Nope. Everything that is not falsy is truthy in JS. The falsy values are: false, 0, "", null, undefined, and NaN. Arrays are Objects. They are not on the list, so they are truthy. Run this: if( [ ] ){ console.log('array is truthy'); } However, think about this - Convert an empty Array to a String and you get "". Convert that into a Boolean and you get false.
@joaovaz34734 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 Ahh, ok. Thanks!
@tracyadams67874 жыл бұрын
Great video. Any chance you could post the link to the operator precedence reference?
@SteveGriffith-Prof3ssorSt3v34 жыл бұрын
It is in the code gist linked to in the description
@webb-developer11 ай бұрын
☑
@siddharthapothan51653 жыл бұрын
Your videos are really helpfull, learnt a lot. But is Number({}) value 0? Thanks!!!
@SteveGriffith-Prof3ssorSt3v33 жыл бұрын
That was a copy paste error in my comments. The gist was updated to show that converting an empty object to a number gives you NaN.
@guignolguignol53404 жыл бұрын
is there in ASP classic or javascript function like CURL in PHP
@SteveGriffith-Prof3ssorSt3v34 жыл бұрын
fetch( ) is the modern JavaScript method for making HTTP Requests. XMLHttpRequest is the old JS method for making HTTP Requests.
@guignolguignol53404 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 Thank you, Mr. Steve, in your view, what you will use to do better
@jassihambran4 жыл бұрын
hey steve. Could you help us in how to setup terminal to run javascript files without any extension?Thanks in advance
@aarong93274 жыл бұрын
Type node in your terminal and it'll run the code in that file.
@jassihambran4 жыл бұрын
@@aarong9327 it does not. When i try it says file could not be found.
@SteveGriffith-Prof3ssorSt3v34 жыл бұрын
It does on Linux and MacOS. I haven't tried on Windows.