2

I want to add an if condition before I can fill the map "mapDataCible". Is that possible?

 inp.forEach(input => mapDataCible[input.get('v.name')] = input.get('v.value'));

1 Answer 1

6

The standard approach would be to use .filter()

inp.filter(input => input.get('v.whatever') === expected).forEach(input => mapDataCible[input.get('v.name')] = input.get('v.value'));

Have a read of the MDN docs on array methods:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .