What are Default parameters in JavaScript?

JavascriptWeb DevelopmentFront End Technology


The default parameter came to handle function parameters with ease. You can easily set Default parameters to allow initializing formal parameters with default values. This is possible only if no value or undefined is passed. Let’s see an example

Live demo

         // default is set to 1
         function inc(val1, inc = 1) {
            return val1 + inc;
Published on 24-Jan-2018 06:56:23