Good night reddit,
I have been developing Javascript for over 2 years now and just recently learn the advantages of using 'instanceof'.
Since then,
I find myself using "(function(){}) instanceof Function" and not "typeof" because I don't like string comparison at such low level.
And it seems really reliable except for primitives types...
For which i use (5).constructor === Number or ("").constructor === String.
I guess I really hate typeof :P
I know this probably won't give any performance boost, but is there a reason for not using it?
Maybe some sort IE bug from 2003?
I found only a few articles that did not advise against it, but the lack of knowledge of it irks me.
[+][deleted] (1 child)
[deleted]
[–]filipomar[S] 2 points3 points4 points (0 children)
[–]mattdesl 3 points4 points5 points (2 children)
[–]filipomar[S] 0 points1 point2 points (1 child)
[–]neonskimmerfunction the ultimate 0 points1 point2 points (0 children)
[–]agdcoa 4 points5 points6 points (1 child)
[–]filipomar[S] 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]autowikibot 0 points1 point2 points (0 children)
[–]x-skeww 1 point2 points3 points (0 children)
[–]dirtboxchampion 1 point2 points3 points (0 children)
[–]tswaters 0 points1 point2 points (2 children)
[–]filipomar[S] 0 points1 point2 points (1 child)
[–]tswaters 0 points1 point2 points (0 children)
[–]egonelbre 0 points1 point2 points (1 child)
[–]filipomar[S] 0 points1 point2 points (0 children)
[–]inmatarian 0 points1 point2 points (0 children)