DEV Community

Discussion on: Best Practice - Check if property exist and assign

Collapse
 
alexcioroianu profile image
Alex Cioroianu

i always use brackets because it is easyer to read and extend.

for example, if you want to add another action inside the if statement, you need to add the brackets anyway.

it’s a best practice that will help you and the developes after you to better understand the logic.

Thread Thread
 
mlueckl profile image
Michael Lueckl

I did indeed run into the case that I added another statement and missed the brackets :)
But overall I agree, was thinking there is a specific technical reason.

Thanks!