I have this code:
if (typeof my.nested.dataset !== "undefined") {
my.nested.dataset.push(data);
} else {
my.nested.dataset = [data];
}
I need to push data to an array but only if the array exists otherwise I need to create one.
I'm repeating my.nested.dataset
three times. What alternatives do I have to append/assign at once.