📌  相关文章
📜  检查条件链接javascript代码示例中的数组是否

📅  最后修改于: 2022-03-11 15:03:51.953000             🧑  作者: Mango

代码示例1
const x = thisIsPossiblyAnArray?.[0];
if (x) {
 console.log("the value of index 0 is", x);
} else {
 console.log("x is undefined as thisIsPossiblyAnArray is either not an Array or is an Array with no item at index 0")
}