Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Amit Gujarathi
Giga Sage
Giga Sage

Hi All,

Hope you all are doing fine.

In today's tutorial, we will look into one important higher-order function in JavaScript which will help you a lot with scripting in ServiceNow.

Let's first understand what is Higher-order function in JavaScript is.

 

Higher-order function:

In JavaScript, functions can be assigned to variables in the same way that strings or arrays can. They can be pasted into other functions as parameters or returned from them as well.

A “higher-order function” is a function that accepts functions as parameters and/or returns a function.

 

Let's now understand the function map in Javascript: The .map() method executes a callback function on each element in an array. It returns a new array made up of the return values from the callback function.

The original array does not get altered, and the returned array may contain different elements than the original array.

 

Please be sure to bookmark this article as well as mark it as Helpful if you thought it was helpful.

 

Regards,

Amit Gujarathi

Technomonk Youtube 

Amit Gujarathi Linkedin 

TheTechnomonk.com 

ServiceNow Community Amit Gujarathi

Version history
Last update:
‎11-10-2022 06:56 AM
Updated by:
Contributors