# 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
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://de-yus-note.gitbook.io/de-yus-note/map.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
