# Default parameters

Suppose we want to allow not specify all settings when using the module. If any of the settings is not specified, then it will take the default value.

For example, in our case, we can make the default type take the value `p`, and the amount - the value `5`:

`;(function({root, type = 'p', amount = 5}) { let parent = document.querySelector(root); for (let i = 1; i <= amount; i++) { let elem = document.createElement(type); parent.append(elem); } })(config);`

In this case, we can easily configure our module in different ways. For example, let's specify only the parent element:

`let config = { root: '#parent', }`

Now let's specify the parent element and the amount. In this case, we will not need to specify the type - after all, the elements of the settings object have no order, and we can omit them as we like. So here is our setup:

`let config = { root: '#parent', amount: 10 }`
← →
↑
en ru