An open API service indexing awesome lists of open source software.

https://github.com/fixjs/patterns.js

Explore JavaScript's best practices and coding style guides.
https://github.com/fixjs/patterns.js

Last synced: 5 months ago
JSON representation

Explore JavaScript's best practices and coding style guides.

Awesome Lists containing this project

README

          

#PatternsJS

It's not an application or a JavaScript library, it is here to showcase the JavaScript's best practices and coding style guides.

As JavaScript developers we have always had whole bunch of repetitive tasks and patterns to deal with and I thought why not gathering all together and put them forward to the JavaScript community.

The initial point which made me set up this repo, was a simple known pattern:

##JavaScript Method Overloading
I have faced with this very question several times and in practice, I have answered it in couple of different ways. Before walking through the possible patterns, let's start with this code snippet:

```
/*
* getData(url)
* getData(url, callback)
* getData(params) params:{ url: '', callback: function(){}, ... }
*/
function getData(){
//...
}
```
[Read more about this pattern.](https://github.com/fixjs/patterns.js/tree/master/patterns/method-overloading)