--

No, people aren’t using if statements for assignment very commonly at all in JavaScript, not when you have ?, ?., &&, ||, and ?? as options.

And React developers have to significantly rearchitect the JSX in their return statements if they want to replace a ? (or &&) for conditional rendering with guard clauses (if x return <>X</>).

Of course, if (and, for some developers, else) are commonly used for branching code — executing different statements based on certain conditions being met. But they’re not common with = assignment.

--

--

Dr. Derek Austin 🥳
Dr. Derek Austin 🥳

Written by Dr. Derek Austin 🥳

Hi, I'm Doctor Derek! I've been a professional web developer since 2005, and I love writing about programming with JavaScript, TypeScript, React, Next.js & Git.

No responses yet