0

If I had a javascript object with the values of

{"__v":0,"_id":"528277c808cab8ac2b000001","password":"password",
"userId":5,"userName":"Austinsss","$$hashKey":"00F"}

How could I remove "$$hashKey":"00F" out of the object entirely.

2
  • use delete operator Commented Nov 14, 2013 at 22:30
  • 4
    this is probably a duplicate of a duplicate of a duplicate I suppose Commented Nov 14, 2013 at 22:31

3 Answers 3

3

delete it!

delete objname["$$hashKey"];
Sign up to request clarification or add additional context in comments.

3 Comments

Answer first so you get the points. Though thanks everyone for there quick responses.
First answers aren't always the best ones. Bear that in mind for your future questions
It's true, @Bojangles answer was more detailed than mine was, and I'm pretty sure I wasn't the first. But thank you
3

Use delete(MDN):

var foo = {"__v":0,"_id":"528277c808cab8ac2b000001","password":"password",
"userId":5,"userName":"Austinsss","$$hashKey":"00F"};

delete foo.$$hashKey;

You could also use bracket notation if you have keys with odd characters in them:

delete foo['$$HashKey'];

2 Comments

I think it's most commonly referred to as bracket notation.
Thanks, updated. I wasn't sure what to go with, an "array notation" will confuse people
3

How about

delete obj.$$hashKey

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.