I wonderer how to have a function with parameter option.
I have a function who I have label, brand, and shop parameter. But it's not working and I don't know how to fix that..
const getTransaction = (shop?:string, brand?:string, label:string) => {
if(shop && brand === null){
return label
}else {
return shop + brand;
}
}
getTransaction("brand","topshop", "topshop - brand")
getTransaction(null,null, "topshop - brand")
A required parameter cannot follow an optional parameter.is what the error says.