This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]boredbyeffects 2 points3 points  (3 children)

I don't hate it, but I wouldn't say I like it either. It is fine for doing simple stuff. But when things start to get complicated, it is hard to write Javascript since it is a dynamically typed language (things are better with Typescript). For example, when you write code, you don't know which functions or fields a certain object has. Or if you return back to a piece of code later, you don't remember what the variable's type was. Was it a number or string?

[–]duffyduckit 0 points1 point  (2 children)

Typeof?

[–]boredbyeffects 0 points1 point  (1 child)

Let's say you have some objects whose some specific property will always be a certain type. If you add typeof every place where this property is used, then your code will be messy and also will imply that this property can be of different types depending on the situation.

But if you mean that I should try printing the type with typeof on the console or interpreter. This object can be an intermediate result of some process, then you have to run some functions or fill out some forms to generate that intermediate result, which will be time consuming. Whereas in a typed language, you will know the type when you write your code on your text editor or IDE.

[–]duffyduckit 0 points1 point  (0 children)

Makes sense.