1. 'API判断数组为空或没有初始化 Private Declare Function SafeArrayGetDim Lib "oleaut32.dll" (ByRef saArray() As Any) As Long Private Sub Command1_Click()Dim tmp() As StringIf SafeArrayGetDim(tmp) = 0 ThenMsgBox "数组为空或没有初始化"End IfEnd Sub 2. Private
//判断数组array中是否包含元素obj的函数,包含则返回true,不包含则返回false function array_contain(array, obj){ for (var i = 0; i < array.length; i++){ if (array[i] == obj)//如果要求数据类型也一致,这里可使用恒等号=== return true; } return false; }