Snippets Collections
function getTotal(list, dir) {
  
  // where if dir is equal to either '>' or.'<'
  return list
    .filter(item => (dir === '<' ? item < 0 : item > 0) && item)
    .reduce((total, item) => (total += item), 0);
}
star

Wed Jun 26 2024 02:40:48 GMT+0000 (Coordinated Universal Time)

#function #symbol #param

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension