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

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:


| 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.