Skip to content

Instantly share code, notes, and snippets.

@imaginate
Created June 30, 2016 01:43
Show Gist options
  • Save imaginate/c6fc6ea5bec7c9657b893f2a71cd2f58 to your computer and use it in GitHub Desktop.
Save imaginate/c6fc6ea5bec7c9657b893f2a71cd2f58 to your computer and use it in GitHub Desktop.
/**
* A method to concat strings to avoid [plus overloading errors](http://www.crockford.com/javascript/javascript.html).
*
* @param {...*} val
* @return {string}
*/
function concatString(val) {
/** @type {string} */
var str;
/** @type {number} */
var len;
/** @type {number} */
var i;
str = '';
len = arguments.length;
i = -1;
while (++i) {
str += arguments[i];
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment