I am new to ES6 Javascript, which means that I am learning it. I like the arrow function and the default parameter function from ES6, which is mentioned on the site below.
http://es6-features.org/#ExpressionBodies
http://es6-features.org/#DefaultParameterValues
Below is my ES6 code snippet, and I tested it in Chrome 47 . I am trying to give a default parameter value for my arrow function, which is currently throwing an error like
<script type="text/javascript"> 'use strict'; var greet = (name = 'Venkat') => (console.log('Hi ' + name + '!')); greet(); </script>
Let me know if this is possible, if so, explain with the solution and what I'm doing wrong here.
user5327940
source share