JSFiddle - React, Tailwind, and code Playground JavaScript var input = -1; var count = (input < 0 ? -input : input); alert(count);