> For the complete documentation index, see [llms.txt](https://de-yus-note.gitbook.io/de-yus-note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://de-yus-note.gitbook.io/de-yus-note/map.md).

# map

實作 Array.map

```
在這邊遇到幾個有趣的問題
for..in 會將可列舉屬性列出 包含 myMap 這個 protoType 的方法

new Array 宣告完 Array 後
Array 的值雖然是 undefiend 但
如果 console 會出現叫 empty item 的東西 
是無法被列舉出來的屬性 

Array.prototype.myMap = function(func, thisObj) {
  const newArr = new Array(this.length);
  for(const index in this) {
    if(index === 'myMap') {
      continue;
    }
    newArr[index] = (func.call(thisObj, this[index], Number(index), this))
  }
  return newArr
}
```
