Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables Working with Strings and Finding Help

Multiple Ways to Code..

var message = prompt("Shout it out here"); alert(message.toUpperCase() + "!!!");

Also works. And also more to the point?

How important is it to come up with multiple solutions to the same problem when it comes to programming? Are less lines always better? I just go with whatever I can quickly come up with.

1 Answer

Steven Parker
Steven Parker
210,425 Points

Rapid development is always a plus, and so is concise code as long as it doesn't impair readability and maintainability. Doing both at once is ideal, but the development purpose will often give you a clue as to which is more valuable in a given situation.

I usually lean to the "rapid" side when the code serves a temporary need, and to the efficient and concise side when the code will be widely distributed and/or used for a long time.