함수 unset()

  다른 뜻에 대해서는 HTML del 태그 문서를 참조하십시오.
  다른 뜻에 대해서는 리눅스 unset 문서를 참조하십시오.
  다른 뜻에 대해서는 PHP unset() 문서를 참조하십시오.
del
unset
delete

1 JavaScript[ | ]

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 PHP[ | ]

$fruits = [ 'a'=>'apple', 'b'=>'banana', 'c'=>'cranberry' ];
unset($fruits['b']);
print_r($fruits);
// Array
// (
//     [a] => apple
//     [c] => cranberry
// )

3 Python[ | ]

fruits = { 'a' : 'apple', 'b' : 'banana', 'c': 'cranberry' }
del fruits['b']
print fruits
# {'a': 'apple', 'c': 'cranberry'}

4 Perl[ | ]

my %fruits = ( 'a' => 'apple', 'b' => 'banana', 'c' => 'cranberry' );
delete $fruits{'b'};

foreach my $key (keys %fruits) {
	my $value = $fruits{$key};
	print "$key : $value\n";
}
#c : cranberry
#a : apple

5 R[ | ]

tmp <- 1:4
tmp
#[1] 1 2 3 4
rm(tmp)
tmp
#Error: object 'tmp' not found

6 같이 보기[ | ]

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