This is the second post of my recurring series on ES6: The next JavaScript. I will be just doing some simple programming tasks in ES6 Javascript.
In my first post of this series, I covered some Introduction to ES6 and also wrote about how to setup your local machine to transpile ES6 with babel. In this post, I’ll explore ES6 classes and Arrow Functions.
Arrow Functions in ES6
So I promised that I’ll do all this while solving some very trivial programming tasks. So here is my task.
#Task 1: Write a Simle Currency Calculator that takes three Arguments, a Number for Conversion Rate, and two ISO 4217 Currency Strings and returns a function that converts any amount from one currency to another.
Solution: I did this thing via new Arrow functions in ES6, and actual Currency Converter code was just one line.[gist 2e2b436b11ac487ad7bf/]