"자바스크립트 delete 연산자"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
3번째 줄: 3번째 줄:
;자바스크립트 delete 연산자
;자바스크립트 delete 연산자


<source lang='JavaScript'>
<syntaxhighlight lang='JavaScript'>
var fruits = {a:'apple',b:'banana',c:'cranberry'};
var fruits = {a:'apple',b:'banana',c:'cranberry'};
delete fruits.b;
delete fruits.b;
console.log( fruits );
console.log( fruits );
// {a: "apple", c: "cranberry"}
// {a: "apple", c: "cranberry"}
</source>
</syntaxhighlight>
<source lang='JavaScript'>
<syntaxhighlight lang='JavaScript'>
var fruits = {a:'apple',b:'banana',c:'cranberry'};
var fruits = {a:'apple',b:'banana',c:'cranberry'};
delete fruits['b'];
delete fruits['b'];
console.log( fruits );
console.log( fruits );
// {a: "apple", c: "cranberry"}
// {a: "apple", c: "cranberry"}
</source>
</syntaxhighlight>
<source lang='JavaScript'>
<syntaxhighlight lang='JavaScript'>
var fruits = ['apple','banana','cranberry'];
var fruits = ['apple','banana','cranberry'];
delete fruits[1];
delete fruits[1];
console.log(fruits);
console.log(fruits);
// ["apple", empty, "cranberry"]
// ["apple", empty, "cranberry"]
</source>
</syntaxhighlight>
<source lang='JavaScript'>
<syntaxhighlight lang='JavaScript'>
var fruits = ['apple','banana','cranberry'];
var fruits = ['apple','banana','cranberry'];
fruits.splice(1,1);
fruits.splice(1,1);
console.log(fruits);
console.log(fruits);
// ["apple", "cranberry"]
// ["apple", "cranberry"]
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:54 기준 최신판

1 개요[ | ]

JavaScript delete 연산자
자바스크립트 delete 연산자
var fruits = {a:'apple',b:'banana',c:'cranberry'};
delete fruits.b;
console.log( fruits );
// {a: "apple", c: "cranberry"}
var fruits = {a:'apple',b:'banana',c:'cranberry'};
delete fruits['b'];
console.log( fruits );
// {a: "apple", c: "cranberry"}
var fruits = ['apple','banana','cranberry'];
delete fruits[1];
console.log(fruits);
// ["apple", empty, "cranberry"]
var fruits = ['apple','banana','cranberry'];
fruits.splice(1,1);
console.log(fruits);
// ["apple", "cranberry"]

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}