JavaScript Code: parseFloat VS parseInt

  • 18 June 2022
  • 0 replies
JavaScript Code: parseFloat VS parseInt
Userlevel 7
Badge +14

📌  We do our best to ensure that the code in these articles works as advertised, but please be aware that Zapier Support does not officially help with code steps due to their advanced nature. Feel free to comment on the article or ask in the Zapier Community, where we have code-savvy users.

The Purpose

How to handle numerical strings in JavaScript Code steps.

  • parseInt() returns the first integer (w/ decimals)
  • parseFloat() returns the first number (w/o decimals)


How to Configure

NOTE: Input Data are all treated as strings.


Copy the Code

let Amount = inputData.Amount;

let AmountFloat = parseFloat(Amount); // returns a number
let AmountInt = parseInt(Amount); // returns an integer

output = [{Amount, AmountFloat, AmountInt}];


The Results


Contribution by Troy Tessalone

Troy is a Certified Zapier Expert who automates workflows with no-code and low-code apps to help clients save time and make money.

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.