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

Symbol.split example with limit optional argument #470

Open
ronen-e opened this issue Jun 5, 2023 · 1 comment
Open

Symbol.split example with limit optional argument #470

ronen-e opened this issue Jun 5, 2023 · 1 comment

Comments

@ronen-e
Copy link
Contributor

ronen-e commented Jun 5, 2023

The example for Symbol.split here manuscript/06-Symbols.md does not mention the optional limit argument:

split(separator)
split(separator, limit)

The current example could perhaps change to

[Symbol.split]: function(value, limit) {
  return value.length === 10 ? ["", ""] : [value];
}

Or perhaps change this text:

Symbol.split - A function that accepts a string argument and returns an array containing pieces of the string split on the match.

To this:

Symbol.split - A function that accepts a string argument and an optional limit argument, and returns an array containing pieces of the string split on the match.

@nzakas
Copy link
Owner

nzakas commented Jun 13, 2023

Ah thanks. Because this book is so old, I wasn't planning on updating it again unless the publisher does another printing. I'll leave this open to remind myself if that happens.

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