Trim function lab
Easy
1
80.0% Acceptance
In this lab, you will implement a trim
function that will remove leading and trailing whitespace from a given string. This function should mimic the behavior of the built-in String.prototype.trim()
method.
Your trim
function should accept a single string argument and return a new string with leading and trailing whitespace removed.
Example:
trim(' Hello World ') // should return 'Hello World'
Do not use the built-in String.prototype.trim()
method in your implementation.