paint-brush
Default Parameters in JavaScript: Beginners Guideby@micogongob
278 reads

Default Parameters in JavaScript: Beginners Guide

by Mico Gongob2mMay 15th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

This article assumes you have some familiarity with coding in the JavaScript ecosystem. In this short article we will cover Function Defaults and learn how to use it in our day to day JavaScript programming. We learned how to set sane default values for the parameters in our JavaScript functions. You can also use function defaults one step further by using another parameter as the default. The product() function just squares the first parameter if the second one isn’t provided. The result is that your code just runs without the correct parameters.
featured image - Default Parameters in JavaScript: Beginners Guide
Mico Gongob HackerNoon profile picture
Mico Gongob

Mico Gongob

@micogongob

Software Engineer from the Philippines

About @micogongob
LEARN MORE ABOUT @MICOGONGOB'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Mico Gongob HackerNoon profile picture
Mico Gongob@micogongob
Software Engineer from the Philippines

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here
Iglob