My personal preference is this:
var assets = "/images" var sounds = assets+"/sounds"
I always use absolute paths (
/images/...), it feels less prone to error, to me. It is also more fool proof to use
var sounds = assets+"/sounds" because even if
assets had a trailing slash and you ended up with
/images//sounds, it would still resolve to
/images/sounds. The one disclaimer being that it depends on your request handler. Apache seems to handle it fine (at least certain versions/configurations, see http://www.amazon.com//gp//site-directory//ref=nav_sad). With the other way you'd end up with
/imagessounds, not so fool proof :) There is also the option of checking for double slashes and cleaning them up. Not an option with the other approach.