$client = [
'info' => [
'company' => 'Apple',
]
];
echo $client['information']['company'] ?? 'N/A';
The above PHP code will show N/A
as output, quietly. While the following Javascript will throw a Uncaught TypeError
:
var user = JSON.parse(' { "info" : { "company" : "apple" } } ');
console.log(user.information.company ?? 'N/A');
Is there a similar ??
operation in Javascript which can show the N/A
result quietly?