Was just wondering if in javascript or typescript there is a way to write the conditional of a fat arrow function in the element mapping itself?
Current code
functionName(data => {
if(data){
}
});
Is there syntax that checks data
before it even gets to the if
statement?
Something like
functionName(data? => {
if(data){ // This code is then not needed
}
});
Or
functionName(!data => {
if(data){ // This code is then not needed
}
});
So that it only passes into the function if data
is falsey.
Thanks