Contoh Operator Penugasan Nullish Coalescing di ES12

// In the example, the ??= will check if the lastname is null or undefined.
// If null or undefined, then the right value will be assigned to the left variable.
let userDetails = {firstname: 'Ranjeet', age: 22}
userDetails.lastname ??= 'Andani';
console.log(userDetails); // This will print: {firstname: 'Ranjeet', age: 22, lastname: 'Andani'}
Outrageous Ostrich