While I was reading about Javascript I found that there are ??
and ?.
and ?.()
operators .
I understood what ?.
means but couldn't understand ??
and ?.()
{This operator is called conditional invocation} . I searched google about ??
and ?.()
but couldn't get that much help .
I found these operator while reading "Javascript the definitive guide 7th edition" by david flanagan .
function1?.();
// when I try to use a function which I didn't define then I get a error so then What is the need of this operator
// but if I try this ...
function square(x, log) {
log?.(x);
return x * x;
}
// this works fine
Please help ..