반응형
js 개체에서 전체 속성을 제거하는 방법이 있습니까?
이상한 질문이긴 하지만 물어봐야 할 것 같아요.
다음과 같은 js 객체가 있는 경우:
$scope.obj1 = {
"name":"John",
"number":"Eleven",
"color":"Red"
}
전체 자산을 제거할 수 있는 방법이 있습니까?값을 새 객체에 다시 할당하지 않습니다.그래서 만약 내가 그걸 없애고 싶다면"number":"Eleven",
이렇게 생겼으면 좋겠는데...
$scope.obj1 = {
"name":"John",
"color":"Red"
}
감사합니다!
JavaScript에는 다음 연산자가 있습니다.
delete $scope.obj1.number
언급URL : https://stackoverflow.com/questions/23619682/is-there-a-way-to-remove-a-whole-property-from-a-js-object
반응형
'programing' 카테고리의 다른 글
사용자 지정 이벤트에서 angular-ui 도구 설명 사용 (0) | 2023.02.27 |
---|---|
새로운 Facebook 앱 개발자에서 샌드박스 모드를 비활성화하려면 어떻게 해야 합니까? (0) | 2023.02.27 |
Spring MVC 명령어개체를 바인드할 때 파라미터 이름을 커스터마이즈하려면 어떻게 해야 합니까? (0) | 2023.02.27 |
wordpress에서 $wpdb를 사용하여 SQL 명령 실행 (0) | 2023.02.27 |
리액트 훅에서 'setState' 콜백을 사용하는 방법 (0) | 2023.02.27 |