javascript trim string to specific length