DEV Community

Discussion on: How would you refactor this JS function?

Collapse
 
rkallan profile image
RRKallan

Assumption when line is not a string return empty string or nothing. In that case there would be no need for a check to print the line. But as I said, it’s a assumption.

The else is redundant and could be replaced with the return statement.