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 trialSheila Katzaman
6,441 PointsDoes adding extra space cause slower web page load time?
The company I work for works with a developer company that writes all our code for our website. Through some research, we discovered our website load time isn't best practice and cleaning up some of our JavaScript can help that. Does the amount of space in JavaScript code count toward the "weight" of the code itself or is the "weight" of the code based on characters written?
1 Answer
Steven Parker
231,271 PointsThe loading time is a factor of the total number of characters, both visible and white space.
A standard optimizing practice is to reduce file size which includes removing all unnecessary white space. A file processed this way is called "minified", and there are several utilities available to assist with this both online and downloadable.
Minified files are difficult to maintain, so the original source should always be kept for doing any further development. The updated file can be minified again before publishing.
Sheila Katzaman
6,441 PointsSheila Katzaman
6,441 PointsThank you. That makes total sense.