Advertisement
jargon

Story05Js :: "history book counter"

Jul 7th, 2024 (edited)
673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function visitedSum(book,page){
  2.     var sum = 0;
  3.     Object.keys(historybook[book]).forEach(page => {
  4.         sum += historybook[book][page];
  5.     });
  6.     return sum;
  7. }
  8.  
  9. function visitedCount(book,page){
  10.     var count = 0;
  11.     Object.keys(historybook[book]).forEach(page => {
  12.         if ( historybook[book][page] > 0 ) {
  13.             count += 1;
  14.         }
  15.     });
  16.     return count;
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement