-
-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add delete operator example #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything ok except one comment
JavaScript/7-delete.js
Outdated
|
||
const org = 'HowProgrammingWorks'; | ||
|
||
// console.log(delete org); // Raises SyntaxError in strict mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why console.log(delete org);
? Just delete org;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¯_(ツ)_/¯
JavaScript/7-delete.js
Outdated
|
||
const country = { | ||
name: 'Chile', | ||
ruler: 'Augusto Pinochet', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
alive: false | ||
}; | ||
|
||
delete country.ruler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✯ 👍 ☭
JavaScript/7-delete.js
Outdated
console.dir({ country }); | ||
|
||
console.log(delete country.born); | ||
console.log(delete country.population); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💋
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have same code pattern in other places: console.log(delete...
I left it to show that this operation returns true, no need in this? |
Added examples of using delete operator with strict mode.
Missing only cases with prototype chain (MDN).