Skip to content

Properties 12.2 #1684

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

Closed
stevewood593 opened this issue Dec 29, 2017 · 4 comments
Closed

Properties 12.2 #1684

stevewood593 opened this issue Dec 29, 2017 · 4 comments
Labels

Comments

@stevewood593
Copy link

stevewood593 commented Dec 29, 2017

Hi,

I think you guys mean "Use bracket notation [] when accessing properties with a function," at 12.2 in the airbnb style guide. Right now it says "Use bracket notation [] when accessing properties with a variable."

@ljharb
Copy link
Collaborator

ljharb commented Dec 30, 2017

I'm not sure what you mean by "with a function" - how is obj[variableContainingKeyName] using a function?

@stevewood593
Copy link
Author

I think the difference between 12.1 and 12.2 is that the 12.2 example occurs within a function:

function getProp(prop) {
  return luke[prop];
}

@ljharb
Copy link
Collaborator

ljharb commented Dec 30, 2017

The rule is referring to bracket notation regardless of context; that it’s a function is irrelevant.

@stevewood593
Copy link
Author

Ok, I get it.

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

No branches or pull requests

2 participants