DEV Community

Discussion on: How would you refactor this JS function?

Collapse
 
reggielee7 profile image
ReggieLee
const lineChecker = (line, isFirstLine) => (`${line === "" ? <br /> : (isFirstLine ? `<h1>${line}</h1>` : `<p>${line}</p>`)}`)
Enter fullscreen mode Exit fullscreen mode

I like the shortest way, but it seems is not readability