Skip to content

Instantly share code, notes, and snippets.

@zabirauf
Created July 4, 2017 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zabirauf/a175781b574df699fa5e8b481e1c59b1 to your computer and use it in GitHub Desktop.
Save zabirauf/a175781b574df699fa5e8b481e1c59b1 to your computer and use it in GitHub Desktop.
function append(
arrOrNum: number | number[],
toAppendArrOrNum: number | number[]): number[] {
if (!Array.isArray(arrOrNum)) {
arrOrNum = [arrOrNum];
}
if (!Array.isArray(toAppendArrOrNum)) {
toAppendArrOrNum = [toAppendArrOrNum];
}
return arrOrNum.concat(toAppendArrOrNum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment