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'));
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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.