map
"It is our choices that show what we truly are, far more than our abilities." —@@jk_rowling
本文为 《lodash 源码阅读》 系列文章,后续内容会在 github 中发布,欢迎 star,gitbook 同步更新。
源码
知识点
你可能会有点奇怪,原生的 map
方法基本没有兼容性的问题,为什么 lodash 还要实现一个 map
方法呢?原因是在于 lodash
中处理数组,会将数组当成 密集数组 对待,原生的 map
方法则将数组当成 稀疏数组 对待。
相关链接
JavaScript —— 稀疏数组与密集数组(TODO)
Last updated
Was this helpful?