0

findReqElementCount(5); // In function we are passing the parameter as 5, which 
    says that we have to count the item 5 occurrence in an array.
     function findReqElementCount(value){
    var occArray=[1,3,5,7,9,5,7,5,10,24,54,5];
    var count=0;
        for(var i=0;i<=occArray.length;i++){
            if(occArray[i]==value){
                count++;
            }
        }
    gs.info(count);
    }

Find out number of times same Value Appears in JavaScript Array ServiceNow
Working Code Asked question May 2, 2024