join(separator) { //Object "this" is a MyArray /* Return our elements joined into a string where each element is separated by arg "separator" */ }
join(separator) { let result = '' iterate over elements (nextElem) result += separator + nextElem return result }
join(separator) { let result = '' iterate over elements (nextElem) result += separator + nextElem return result }
join(separator) { let result = '' iterate over indexes (nextIndex) if (nextIndex > 0) result += separator result += nextElem return result }
join(separator) { let result = '' iterate over indexes (nextIndex) if (nextIndex > 0) result += separator result += nextElem return result }
let result = '' let nextIndex = 0 while (nextIndex < this.size()) { let nextElem = this.get(nextIndex) if (nextIndex > 0) result += separator result += nextElem.toString() } return result
let result = '' let nextIndex = 0 while (nextIndex < this.size()) { let nextElem = this.get(nextIndex) if (nextIndex > 0) result += separator result += nextElem.toString() nextIndex++ } return result