utilizing some of javascript's built-in String.prototype methods