Program JavaScript Untuk Memeriksa Apakah Variabel Tidak Terdefinisi atau null

Contoh 1: Centang undefined atau null // program to check if a variable is undefined or null function checkVariable(variable) { if(variable == null) { console.log(‘The variable is undefined or null’); } else { console.log(‘The variable is neither undefined nor null’); } } let newVariable; checkVariable(5); checkVariable(‘hello’); checkVariable(null); checkVariable(newVariable); Keluaran The variable is neither undefined nor […]

Read more »