MyThinkPond

On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

  • Recent Posts

    August 2017
    M T W T F S S
    « Jul    
     123456
    78910111213
    14151617181920
    21222324252627
    28293031  
  • Subscribe Options

  • Awards

    JavaCodeGeeks
  • Most Valuable Blogger @ DZone
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 172 other followers

  • Follow MyThinkPond on WordPress.com
  • Blog Stats

    • 364,739 hits
  • General Options

Archive for the ‘ES6’ Category

Javascript: Embrace Arrow Functions

Posted by Venkatt Guhesan on May 3, 2017

Great article on JavaScript currying and arrow functions.

Here is an example of a function in Javascript:

const secret = function (msg) {
    return function () {
        return msg;
    };
};

The same function as currying or arrow function:

const secret = msg => () => msg;

To learn more about the basics, visit the link below.
Source: Familiarity Bias is Holding You Back: It’s Time to Embrace Arrow Functions

Posted in ES6, Javascript | Tagged: , , , | Leave a Comment »

Angular Modules vs ES6 Modules – DZone Web Dev

Posted by Venkatt Guhesan on March 13, 2017

In this post, you’ll find a quick tutorial explaining the difference between Angular Module and ESG Modules, and how to best use each of these platforms.

Here is a quick summary:

ES6 Module Example:


import { sqrt } from 'math-utils';

const addition = (val1, val2) => val1 + val2;
const subtraction = (val1, val2) => val1 - val2;
const multiplication = (val1, val2) => val1 * val2;
const calculateSquareRoot = (val) => sqrt(val);

export { addition, multiplication }

Angular Module Example:


@NgModule({
imports: [ BrowserModule, HttpModule, FormsModule ],
declarations: [ PersonComponent, ContactComponent, ContactListComponent ],
providers: [ PersonService, ContactService ],
exports: [ ContactListComponent, ContactComponent ]
})

export class ContactModule {}

Source: Angular Modules vs ES6 Modules – DZone Web Dev

Posted in Angular, ES6, Javascript | Tagged: , , , | Leave a Comment »