Parameter
        
            
                Última atualização em 
                
                    11/01/2022
                
            
            
        
        
    
Description
Iterates over every entry of the array and calls the closure to work on the elements of the array. This function will reduce the array to a single value from the right to the left  and will return the value.
Returns
Any
Syntax
ArrayReduceRight(array, function(result, item, [,index, array])[, initialValue])
History
ColdFusion (2021 release): Added this function.
Parameters
| 
                    
     | 
                
            
                
                    
     Required/Optional  | 
                
            
                
                    
     Description  | 
                
            
        
|---|---|---|
| 
                    
     array  | 
            
                
                
                    
     Required  | 
            
                
                
                    
     The input array.  | 
            
        
| 
                    
     function  | 
            
                
                
                    
     Required  | 
            
                
                
                    
     Closure or a function reference that will be called for each of the iteration. The arguments passed to the callback are 
  | 
            
        
| 
                    
     initialValue  | 
            
                
                
                    
     Optional  | 
            
                
                
                    
     Initial value which will be used for the reduce operation. The type is any.  | 
            
        
Example 1
<cfscript> 
       data = ['1','2','3','4','5','6']; 
       stringConcat = ArrayReduceRight(data,function(previous,next) { 
        return previous & next; 
       },""); 
       writeOutput(stringConcat) 
</cfscript>
		
	
Output
654321
Example 2
<cfscript> 
    data=[3,5,7,9,11] 
    result=ArrayReduceRight(data,function(previous,next){ 
        return previous & next 
    },"") 
    writeDump(result) 
</cfscript>
		
	
Output
119753
Example 3- member function
<cfscript> 
    data=[3,5,7,9,11] 
    result=data.ReduceRight(function(previous,next){ 
        return previous & next 
    },"") 
    writeDump(result) 
</cfscript>
		
	
Output
119753