Skip to content
loading...

Reading Snippets [46 => Objects] πŸ“”

github logo ・1 min read  

The only way to remove a property from an object is to use the delete operator. Using null or 0 only removes the value associated with the property but not the key.

The keyword may need to be notated as a string literal in order for it to be properly interpreted by older JavaScript engines.


var test = {
'case': 'I am a keyword, so I must be notated as a string',
delete: 'I am a keyword, so me too' // raises SyntaxError
};

Source:JavaScript Garden

twitter logo DISCUSS
Classic DEV Post from Mar 20

What was your win this week?

Got to all your meetings on time? Started a new project? Fixed a tricky bug?

Calvin profile image
Coding for good

Make better choices about your code and your career.

Create Your Account. 100% Free Forever.