parseInt() . But there is also an easy way to do that without using
We can achieve the same result just by using the unary operator
+ at the beginning of the string.
Have a look at the examples below:
let age = "23"; console.log(typeof age); //string console.log(typeof parseInt(age)); //number
let age = "23"; console.log(typeof age); //string console.log(typeof +age); //number
You can also convert a number to a string just by concatenating the number with an empty string.
Here is an example:
let age = 19 + ""; console.log(typeof age); //string
As you can see, you can easily convert a number to a string with this technique.
Static code analysis is a method of debugging by examining source code before a program is run. It's done by analyzing a set of code against a set (or multiple sets) of coding rules. Static code analysis and static analysis are often used interchangeably, along with source code analysis.