javascript shorthand get length if not null code example
Example 1: if shorthand typescript
const answer = x > 10 ? "greater than 10" : "less than 10";
Example 2: shorthand if in javascript with return
pet = pets.find(pet => pet.type ==='Dog' && pet.name === 'Tommy');
console.log(pet); // { type: 'Dog', name: 'Tommy' }