Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1. One parameter in ES6
- let sum = (a, b) => a + b;
- // in ES5
- var sum = function(a, b) {
- return a + b;
- };
- // 2. Without parameters in ES6
- let randomNum = () => Math.random();
- // in ES5
- var randomNum = function() {
- return Math.random();
- };
- // 3. Without return in ES6
- let message = (name) => alert("Hi " + name + "!");
- // in ES5
- var message = function(yourName) {
- alert("Hi " + yourName + "!");
- };
Add Comment
Please, Sign In to add comment