removing spaces at end of js