1

I have an array of attributes and their values. I also have an array of attributes that I would like removing if present.

options.noAttr[0] = "tipref"

and attributes.tipref would equal the value.

If I wanted to remove attributes.tipref, I would have to call it dynamically, looping through the noAttr's, such as

attributes.{options.noAttr[i]};

Obviously, the above does not work.

Can anyone lend a hand?

1 Answer 1

2

This what you want?

delete attributes[options.noAttr[i]];

In javascript, array['key'] is the same as array.key.

Sign up to request clarification or add additional context in comments.

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.