Dear All,

I need reduce() method working in some condition not satistification the 
stop the execution.

Please Help me.

Below mentioned the Example code:

const array = ['apple', '-pen', '-pineapple', '-pen'];
    const x = array
      .slice(0) // create copy of "array" for iterating
      .reduce((acc, curr, i, arr) => {
        if (i === 1) 
           arr.splice(1); // eject early by mutating iterated copy
          console.log('i=> ', i);       
      }, '');

    

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/20a8a6c5-6ec2-4afc-b7e7-6433978483b9n%40googlegroups.com.

Reply via email to