Top features in ES 6 / Javascript 2015
ES6 allows function parameters to have default values.
function myFunction(x, y = 10)
{
// y is 10 if not passed or undefined
return x + y;
}
myFunction(5); // will return 15
Comments
Post a Comment