-
Notifications
You must be signed in to change notification settings - Fork 90
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
Working with iterative methods and binding #336
Comments
The syntax is right, but like all variables, both |
@ljharb
let bassist;
const beatles = [["John", "guitar"], [["Paul", "bass"], ["George", "guitar"], ["Ringo", "drums"]];
if (beatles.some(member => member is [String and bassist, "bass"])) {
console.log(`The bassist is ${bassist}.`);
}
|
Yes, variables inside a callback are different (or rather, the only variables that are different are in an if clause, and it’s not super clear if that’s viable anyways) The way to make that code work is |
This code reminds me of another thing. beatles.some(member => member is [String and const bassist, "bass"]) Did we do the grammar right? Is this |
@ljharb Thanks for the response. I understood.
I need the answer for this question. I meant the former: |
@NagayamaToshiaki Yes! I understand your intention, I mean if we're doing right in the specification so it parses the same as what you mean in this case |
For example, I would like to write the code like this:
bassist
? Does the scope work like this?Then think of following code:
How does the code handle
guitarist
? Should it throw an error becauseguitarist
is bound twice?if
guitarist
islet
, is its value "George"?I do not think the first code will throw an error because binding is executed only once.
The text was updated successfully, but these errors were encountered: