What’s wrong with adding properties to DOM Element objects?

Is there a problem adding properties (or methods) directly to DOM Element Objects? Potentially. There is no web standard that says you can add arbitrary properties to DOM nodes. They are ‘host objects’ with browser-specific implementations, not ‘native JavaScript objects’ which according to ECMA-262 you can do what you like with. Other host objects will … Read more

How can I remove an element from a list, with lodash?

As lyyons pointed out in the comments, more idiomatic and lodashy way to do this would be to use _.remove, like this _.remove(obj.subTopics, { subTopicId: stToDelete }); Apart from that, you can pass a predicate function whose result will be used to determine if the current element has to be removed or not. _.remove(obj.subTopics, function(currentObject) … Read more

Find object having maximum value for the `id` property in an array of objects

The question states that he wants to find the object with the greatest id, not just the greatest id… var myArray = [{‘id’:’73’,’foo’:’bar’},{‘id’:’45’,’foo’:’bar’}]; var max = myArray.reduce(function(prev, current) { if (+current.id > +prev.id) { return current; } else { return prev; } }); // max == {‘id’:’73’,’foo’:’bar’}

New object with HQL

I think that the section 15.6. The select clause covers what you’re trying to achieve: 15.6. The select clause … Queries can return multiple objects and/or properties as an array of type Object[]: select mother, offspr, mate.name from DomesticCat as mother inner join mother.mate as mate left outer join mother.kittens as offspr Or as a … Read more