My understanding after reading this post:
Javascript is dynamically type and we can blindly declare a variable without specifying the type and use it as of our needs.
In typescript, we need to give the type for the varible like variableA: number, varibleB: string, so it is statically typed.
A small question : will there be any performance difference between dynamically typed and statically typed as in dynamic typed, the type is decided only at the runtime but in statically type, it is know at the compile time itself
As for the question, type checks are performed during build time, so it won't affect runtime in any means. Dynamic type checks are more like checks if there is a given property and that's it.
Btw, this only addressing JS/TS, because I've heard that type checks in Python are performed during runtime, which may introduce some overhead.
Also, you can play with typescript in its playground.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My understanding after reading this post:
Javascript is dynamically type and we can blindly declare a variable without specifying the type and use it as of our needs.
In typescript, we need to give the type for the varible like
variableA: number, varibleB: string
, so it is statically typed.A small question : will there be any performance difference between dynamically typed and statically typed as in dynamic typed, the type is decided only at the runtime but in statically type, it is know at the compile time itself
Hey π Yep, it's correct.
As for the question, type checks are performed during build time, so it won't affect runtime in any means. Dynamic type checks are more like checks if there is a given property and that's it.
Btw, this only addressing JS/TS, because I've heard that type checks in Python are performed during runtime, which may introduce some overhead.
Also, you can play with typescript in its playground.