diff --git a/src/arrayMethodJoin.js b/src/arrayMethodJoin.js index cb39c800..fb37e954 100644 --- a/src/arrayMethodJoin.js +++ b/src/arrayMethodJoin.js @@ -9,6 +9,11 @@ const isNotIgnoredEl = (el) => ![null, undefined].includes(el); function applyCustomJoin() { [].__proto__.join2 = function(separator = ',') { const currentArray = this; + + if (!(currentArray instanceof Array)) { + return ''; + } + const INDEX_OF_LAST_ELEMENT = currentArray.length - 1; let concatedString = '';