จาวาสคริปต์โปรดตรวจสอบว่าอยู่ก่อนฟังก์ชัน
//check if sayHello() function exists
if (typeof sayHello === "function") {
// This function exists
}
โปรดตรวจสอบว่าอยู่ก่อนฟังก์ชันจาวาสคริปต์
if (typeof payment === "function")
{
// Do something
}
js ตรวจสอบว่าอยู่ก่อนฟังก์ชัน
if (typeof yourFunctionName == 'function') {
yourFunctionName();
}
โปรดตรวจสอบว่าอยู่ก่อนฟังก์ชัน
const obj = {first: function() {console.log("ssss"); return "returns"} };
console.log(_.result(obj, "first"));
/*note that _.result() returns a value, so if your function doesn't return anything _.result() will return undefined*/