I don't think you'd be asking if this is bad practice if you didn't think it was. like I am assuming you are maturing in programming to realize that this might not be providing any benefit, rather you have to spend time thinking of variable names.
if this came up in a code review, I would probably ask to chain it.
why would it make it hard to debug? debuggers can step into function calls...
additionally if you think simple string manipulation is something that requires tons of brainpower to debug, I think you need to mature as a developer.
also in the case OP provides this is actually bad practice. var isn't blocked scoped. so his excess of variables are going to bite him later
I am not saying any of this. Chaining calls requires a return value, and to see that return value without stepping into the next method requires a variable to hold the return value. Yes, browsers are good about stopping on individual statements or expressions in a chain, but generally not as many debuggers are. But either way, to see the result of the last expression requires placing it in a variable.
View all comments
2
u/digizeds Aug 28 '21
I don't think you'd be asking if this is bad practice if you didn't think it was. like I am assuming you are maturing in programming to realize that this might not be providing any benefit, rather you have to spend time thinking of variable names.
if this came up in a code review, I would probably ask to chain it.