Removing whitespace
Given a string, remove leading or trailing whitespaces and return a new string.
Sample Code:
function rmvSpace(str) {
// Enter your logic here...
}
Examples:
Input: 'Tom and Jerry '
Output: 'Tom and Jerry'
Explanation: Whitespaces are removed from both sides of the string.
Input: ' Javascript '
Output: 'Javascript'
Explanation: Whitespaces are removed from both sides of the string.