3 ms·
Destructuring assignment could also helps readability, for example: function replace(text, {fromText = '', toText = '', caseInsensitive = false} = {}){ //
by wildpeaks 10y ago
Destructuring assignment could also helps readability, for example:
function replace(text, {fromText = '', toText = '', caseInsensitive = false} = {}){
//
// ...
//
}
replace(
'Get on the Road',
{
fromText: 'road',
toText: 'bus',
caseInsensitive: true
}
);