Skip to content

using arrow function,this keyword and classes in place of normal function #168

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
itsvinayak opened this issue May 11, 2020 · 4 comments
Closed
Labels
changes required This pull request needs changes on hold Being discussed by the maintainers question Furthur information is requested

Comments

@itsvinayak
Copy link
Member

we should update contributing guidelines to use arrow function, this keyword and classes over traditional function as they provide some good features of ECMAScript, provide more readability and allow a user to write less code.

12 Reasons Why ES6 is the future of JavaScript and Web Development

@itsvinayak itsvinayak added changes required This pull request needs changes question Furthur information is requested labels May 11, 2020
@TheAlgorithms TheAlgorithms deleted a comment from itsvinayak May 11, 2020
@cclauss
Copy link
Member

cclauss commented May 11, 2020

I am not an active JavaScript developer. I can say that in Python, there is a movement away from classes (trying to do more in functions and less in OOP) and away from anonymous functions because normal functions are easier to understand (more self-documenting) and easier to test.

Hopefully active JavaScript developers can jump into this discussion and provide proper feedback.

@itsvinayak itsvinayak added the on hold Being discussed by the maintainers label May 11, 2020
@ayaankhan98
Copy link
Member

it is not always necessary to use arrow funtions because along with benefits there are pitfalls also if one is not carefull about using them such as the this keyword behaves differently with normal functions and arrow functions.
i think the best is to use normal functions for object methods and use arrow functions for callbacks or methods like map, reduce, or forEach.

@itsvinayak
Copy link
Member Author

@ayaankhan98, this issue is on hold for a long time should we close it (if not needed) or wait for other members to review

@ayaankhan98
Copy link
Member

let's close this and let the contributor to decided the best possible design for the program let it be up to them to use arrow functions or calsses what we can do is that if something is not fine or if there is some another way to do that thing in more efficient way then we can ask them to change the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes required This pull request needs changes on hold Being discussed by the maintainers question Furthur information is requested
Projects
None yet
Development

No branches or pull requests

3 participants