I'm pretty new to JS and i'm trying to learn some basics in functions.
I'm facing a problem, I've created a function like this:
function someName (element, settings={i:"#1d252c", i2:"#fff"}) {
.......
}
If i call the function as someName(element)
. i and i2 retain their values, however
If i call it like someName(element,{i:"#3acbda"})
, the value of i does change however the value of i2 is undefined,
So how do i assign the default value to a property when the settings object is no longer the default value.
So when i assign settings with only i, i2 is just the default value "#fff" and not undefined.