How to check if array element exists or not in javascript?

前端 未结 18 1721
粉色の甜心
粉色の甜心 2020-12-07 10:05

I am working with Titanium, my code looks like this:

var currentData = new Array();

if(currentData[index]!==\"\"||currentData[index]!==null||currentData[ind         


        
18条回答
  •  悲&欢浪女
    2020-12-07 10:25

    (typeof files[1] === undefined)?
                this.props.upload({file: files}):
                this.props.postMultipleUpload({file: files widgetIndex: 0, id})
    

    Check if the second item in the array is undefined using the typeof and checking for undefined

提交回复
热议问题