Skip to content

Move function declaration before reference #5491

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

Merged
merged 1 commit into from
Oct 21, 2020
Merged

Move function declaration before reference #5491

merged 1 commit into from
Oct 21, 2020

Conversation

DanielPower
Copy link
Contributor

The way the example is currently presented requires that the user have an understanding of how Javascript hoists functions.

By moving the function declaration before the function reference, the order of the code becomes more clear to the reader, which I think is valuable here.

I think it's more important that this material clearly teach the behavior of Svelte, rather than the nuances of Javascript.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with npm test and lint the project with npm run lint

Copy link
Member

@Conduitry Conduitry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're changing the app-b ('after') version of a tutorial, the app-a ('before') version should also be changed accordingly.

@DanielPower
Copy link
Contributor Author

Good catch, thank you. That has been resolved.

The way the example is currently presented requires that the user have an understanding of how Javascript hoists functions. By moving the function declaration before the function reference, the order of the code becomes more clear to the reader, which I think is valuable here. I think it's more important that this material clearly teach the behavior of Svelte, rather than the nuances of Javascript.
@DanielPower
Copy link
Contributor Author

Updated once more, since Prettier did some auto-formatting I didn't mean to commit.

@DanielPower DanielPower requested a review from Conduitry October 4, 2020 21:07
@DanielPower
Copy link
Contributor Author

@Conduitry your comment has been resolved. Please re-review when you have a chance.

@benmccann benmccann merged commit 379a445 into sveltejs:master Oct 21, 2020
@DanielPower DanielPower deleted the patch-1 branch October 21, 2020 22:22
taylorzane pushed a commit to taylorzane/svelte that referenced this pull request Dec 17, 2020
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

Successfully merging this pull request may close these issues.

3 participants