Here is my data structure:
var data = [
{ id: '1924', info: 'boo' },
{ id: '1967', info: 'foo' }
];
The id value must be unique, but the information may not be unique. How to add new data to the hash data only if the unique identifier of the new data is unique?
Is the only way to iterate over the entire hash and see if such an identifier is already in place?
data.push({ id: '1967', info: 'goo-goo' });
data.push({ id: '1963', info: 'goo-goo' });
source
share