Categories
JavaScript Answers

How to convert string to number with Node.js?

Spread the love

To convert string to number with Node.js, we call the parseInt function.

For instance, we write

const year = parseInt(req.params.year, 10);

to call parseInt to convert req.params.year to a decimal integer.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *