JSFiddle - React, Tailwind, and code Playground

by David Simpson

JavaScript

const emptyIssueContextViews = {
  'jsd.portal.view': 0, // Jira Service Management portal view (the customers' view)
  'jira.agent.queue': 20, // Jira Service Management Agents view
  'jira.issue.view': 0, // The standard Jira Issue View
  'jira.issues.list': 0, // An issue viewed in a list of Jira issues
  'jira.rapid.board.planning': 0, // An issue viewed in a planning board
  'jira.rapid.board': 0, // An issue viewed in a standard Jira agile board
  'jira.other': 10, // All other views
};


/* 
for (let key in emptyIssueContextViews){
   if(emptyIssueContextViews.hasOwnProperty(key)){
     console.log(`${key} : ${emptyIssueContextViews[key]}`)
     total += emptyIssueContextViews[key];
   }
}

console.log(total); */


const sumOfKeys = (obj) => {

  let total = 0;
  for (let key in obj){
     if(obj.hasOwnProperty(key)){
//       console.log(`${key} : ${obj[key]}`)
       total += obj[key];
     }
  }
  return total;
}



console.log(sumOfKeys(emptyIssueContextViews));