Default function parameters in ES6

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

Here is an example of using default function parameters in ES6:

default function parameters

You see that the browser displays “Hello John” because we passed in the value “John” into the sayHello function. ¬†However, because in our function definition, we had supplied a default value, we can call the function with no parameter value and the default value will be used…

using default function parameter

More ES6 features here.