Typecasting
Protect your application with typecasting.
We'll cover the following
What is typecasting?
One additional step, for security and data integrity, is to typecast known formats. Since JavaScript is dynamically typed, a value can be any type. By typecasting the value, you can verify that the data matches are what you expect. Recall the previous MySQL example. If the ID came from a variable, it would make sense to typecast it, only if you know it should always be an integer, like this:
Get hands-on with 1400+ tech skills courses.