Categories JavaScript Answers How to convert string to number with Node.js? Post author By John Au-Yeung Post date September 10, 2022 No Comments on 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. Related Posts How to convert string to buffer with Node.js?Sometimes, we want to convert string to buffer with Node.js. In this article, we'll look… How to convert Node.js MongoDB object id to string?To convert Node.js MongoDB object id to string, we call the toString method. For instance,… How to convert string to ObjectId with Node.js Mongoose?Sometimes, we want to convert string to ObjectId with Node.js Mongoose. In this article, we'll… By John Au-Yeung Web developer specializing in React, Vue, and front end development. View Archive → ← How to update npm on Windows? → How to toggle between multiple .env files like .env.development with Node.js? Leave a Reply Cancel replyYour email address will not be published. Required fields are marked *Comment * Name * Email * Website Save my name, email, and website in this browser for the next time I comment. Current ye@r * Leave this field empty