Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
229,005 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.