I have this javascript Object named group.
I am trying to add another object into this called Rule if the group.Rule object is null. My code is like so:
var ruleObj = {
Id: null,
RuleId: null,
MatchLogic: 0,
Min: null,
Max: null,
TagIds: null
};
group.Rule = group.Rule == null ? group.Rule = ruleObj : group.Rule;
I would think that group.Rule = ruleObj would do it but console logging it shows that group.Rule is {} empty.
How do I add the group.Rule object onto group?
group.Rule = group.Rule == null ? ruleObj : group.Rule;— more succinctly you could use an or operator (||):group.Rule = ruleObj || group.Rule. This won't resolve your problem though :)isEmpty(andextend, which could probably help with higher-level problems).