Program JavaScript untuk Memeriksa Apakah Variabel adalah Tipe Fungsi

Contoh 1: Menggunakan instanceof Operator // program to check if a variable is of function type function testVariable(variable) { if(variable instanceof Function) { console.log(‘The variable is of function type’); } else { console.log(‘The variable is not of function type’); } } const count = true; const x = function() { console.log(‘hello’) }; testVariable(count); testVariable(x); Keluaran […]

Read more »