Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does the $.map function return a flatten array? #1334

Open
dongliang1993 opened this issue Mar 6, 2018 · 1 comment
Open

Why does the $.map function return a flatten array? #1334

dongliang1993 opened this issue Mar 6, 2018 · 1 comment

Comments

@dongliang1993
Copy link

Zepto:
$.map([1, 2, [3, 4]], val => val)
// return [1, 2, 3, 4]
ES6:
[1,2,[3,4]].map(val => val)
// return [1, 2, [3,4]]

@watnab
Copy link

watnab commented Sep 5, 2018

Zepto may intend to be compatible with jQuery not ES6.

http://api.jquery.com/jquery.map/

The function can return:
an array of values, which will be flattened into the full array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants