Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Saturday, March 24, 2018

Javascript to split ; ServiceNow Script

var str = "172.168.1.1";
var res = str.split(".", 2);
gs.log(res);

https://www.w3schools.com/jsref/jsref_split.asp


Thursday, March 22, 2018

Get union of 2 arrays removing intersection values (Javascript)


var array1 = ['12','1','10','19','100','test'];
var array2 = ['12','10','19','test1'];
var array3 = array1.filter(function(obj) { return array2.indexOf(obj) == -1; });
var array4 = array2.filter(function(obj) { return array1.indexOf(obj) == -1; });
gs.print('----> array1 Values----->'+  array1);
gs.print('----> array2 Values----->'+  array2);
gs.print('----> array3 Values----->'+  array3);
gs.print('----> Concat Values----->'+  array3.concat(array4));








Reference:
https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items


Discovery troubleshooting | Error messages

  Discovery troubleshooting | Error messages - Support and Troubleshooting (servicenow.com) Description Learn how to resolve common Discover...