2

Is it possible to remove an element of a Javascript associative array (i.e., set back to native undefined)?

When I tried simply alert(array['knownKey']); array['knownKey']=undefined; alert(array['knownKey']); ... the second alert produced the literal undefined... whereas, the first alert returned nothing.

1

1 Answer 1

2

To actually delete an element, use

delete array['knownkey'];
Sign up to request clarification or add additional context in comments.

1 Comment

very helpful coming from php dev perspective - lack of unset()

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.