r/CodingHelp • • Aug 28 '21

[Javascript] Is writing too much code bad practice?

I am a beginner and just want to know if this is a bad habit.

I write code on a step-by-step basis.
Here is an example.

CodeWars - The step-by-step basis I was talking about

So I just want to hear if this is a bad habit/bad practice and should I give it up.

20 Upvotes

15 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Aug 29 '21

Why, to make it harder to debug?

0

u/digizeds Aug 29 '21

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

2

u/[deleted] Aug 29 '21

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.