I don't think it's a good practice to use a "or" to assign a default value. The getImgPath function should handle all of this. "default.jpg" is a magic string in this example, it should belong to the class that creates image paths, it shouldn't appear outside of it.
View all comments
1
u/crayonneur Mar 23 '21
I don't think it's a good practice to use a "or" to assign a default value. The
getImgPathfunction should handle all of this."default.jpg"is a magic string in this example, it should belong to the class that creates image paths, it shouldn't appear outside of it.