Linq equivalent operations in JavaScript