Hello I am at some new project and just saw something that could not understand.
I tried to make an easier example as of what we have here in project but the basis is something like the following.
function getSomething (data: string )
{
console.log(data);
//do something else with a
}
let data; //data get's loaded from backend
getSomething(data ?? 'data 2');
As I have played with it, it seems that data get's a default value of 'data 2'.
I already know about typescript's default value in parameters. Are those 2 concepts related? I am familiar with the following logic
function getSomething (data: string ='data3')
{
console.log(data);
//do something else with a
}
let data;
getSomething(data); //if data is undefined it passes 'data3'
What is ?? all about?