Skip to content

Instantly share code, notes, and snippets.

@Akifcan
Created July 10, 2022 09:08
Show Gist options
  • Save Akifcan/ce3733dca107c2ca1a292de5070c196d to your computer and use it in GitHub Desktop.
Save Akifcan/ce3733dca107c2ca1a292de5070c196d to your computer and use it in GitHub Desktop.
My own map implementation in javascript
const people = [
{
name: 'akif',
status: 'full stack developer'
},
{
name: 'sebnem ferah ❤❤',
status: 'artist'
},
]
Array.prototype.myMap = function(cb){
const output = []
this.forEach((x, i) => {
output.push(cb(x, i))
})
return output
}
const x = people.myMap((c, i) => {
return ({
"isim": c.name,
"durum": c.status
})
})
console.log(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment