Reduce size in javascript