Number Array MIN/MAX with JavaScript Code Step

  • 29 June 2022
  • 0 replies
  • 62 views
Number Array MIN/MAX with JavaScript Code Step
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

Find the MIN/MAX number from an unsorted Number Array.

The Inputs

The Code

let Set = inputData.Set.split(","); // splits the array into items
let MIN = Math.min.apply(null,Set); // finds the MIN value
let MAX = Math.max.apply(null,Set); // finds the MAX value

output = [{MIN, MAX, Set}];

 

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.