How can I declare optional function parameters in JavaScript? [duplicate] by IT Nursery Can I declare default parameter like function myFunc( a, b=0) { // b is my optional parameter } in JavaScript? 2 Answers 2