Making use of localized variables in javascript.