Published On May. 2nd 2016

ES2015 Crash Course: Default Parameters

Episode 5 Run Time 2:19

ES5 doesn't offer support for default parameters. So, as a result, we all ended up resorting to less-than-ideal alternatives (like name = name || 'Joe'). Luckily, with ES6, it'll all just work the way you'd expect. Even better, you're not limited to primitives alone; you can even set the default value equal to the result of a function call!