js 判断数组是否包含某个key

可以用函数hasOwnProperty来进行判断,如下:

if (result.hasOwnProperty('code') && !result.code) {
	alertify.alert(result.msg)
}


猜你喜欢

转载自blog.csdn.net/u011085172/article/details/77989415