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 Jul 5 '19

What's one thing you wish you knew before you started programming?

Calvin profile image

Hey there reader...

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. โค๏ธ