var str = " Arjun PHP ";
var newStr = $.trim(str);
NOTE:Trim function only removes spaces from starting and end of the string. If there are any space between middle of the statement that is ignored.
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.