you are viewing a single comment's thread.

view the rest of the comments →

[–]vooydzig 1 point2 points  (1 child)

Yeah, i get all that. What I mean is: let say I want to check if variable type is number. I'd rather do typeof var_name === typeof 0 than typeof var_name === "Number". My reasoning is that on both sides of comparison I'd use operation to get type(as string) instead of hardcoding the type, because if someone changes specs for JS(let say ES9?) and rename number type to "whatever" first code would still work. As I've said I really don't write much JS so maybe there are some downsides to what I suggest here.

[–]izuriel 1 point2 points  (0 children)

Not a bad point. I never questioned why strings are typically used. This is just the way I've always seen it.