javascript] json isEmpty (빈 오브젝트인지 검사 empty object)


javascript] json isEmpty (빈 오브젝트인지 검사 empty object)

var json_object = {} var json_array = [] json_array의 경우는 비어있는지 체크할 때 json_array.length 가 0인지 체크하면 되지만 json_object의 경우는 length를 사용하면 제대로 된 결과를 얻을 수 없다. 이 경우 jquery에서 제공해 주는 isEmptyObject()를 사용하면 된다. 출처 : http://api.jquery.com/jQuery.isEmptyObject/ 1. 리턴 값 비어있는 object이면 true를 리턴 2. 사용법 2.1. if(jQuery.isEmptyObject(json_object)) { // 비어 있을 경우 } 2.2. if(true === jQuery.isEmptyIObject(json_object)) { // 비어 있을 경우 }...


#IT·컴퓨터

원문링크 : javascript] json isEmpty (빈 오브젝트인지 검사 empty object)