wiki/content/20201113094652-javascript_delete_operator.md

23 lines
413 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-11-13
2024-05-06 20:40:05 +00:00
id: aed94d48-374c-4f3d-8dca-b6e4b3f9ae83
title: JavaScript Delete Operator
---
# Description
The `delete` operator deletes a binding (duh).
# Syntax
``` javascript
let anObject = { left: 1, right: 2 };
console.log(anObject.left); // 1
delete anObject.left;
console.log(anObject.left); // undefined
console.log("left" in anObject); // false
console.log("right" in anObject); // true
```