Tuesday, February 6, 2018

Simplify a .some in TypeScript with the fat arrow!

This may all be simplified, by getting rid of the checkAdult function by using a fat arrow operator in TypeScript like this:

function myFunction() {
   document.getElementById("demo").innerHTML = ages.some(a => (a >= 18));
}

No comments:

Post a Comment