Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         var blinds = [
  2.             {
  3.                 "round": 1,
  4.                 "duration":20,
  5.                 "break":0
  6.             },
  7.             {
  8.                 "round": 2,
  9.                 "duration":20,
  10.                 "break":0
  11.             },
  12.             {
  13.                 "round": 3,
  14.                 "duration":20,
  15.                 "break":0
  16.             },
  17.             {
  18.                 "round": 4,
  19.                 "duration":20,
  20.                 "break":20 //break here
  21.             },
  22.             {
  23.                 "round": 5,
  24.                 "duration":20,
  25.                 "break":0
  26.             },
  27.             {
  28.                 "round": 6,
  29.                 "duration":20,
  30.                 "break":0
  31.             },
  32.             {
  33.                 "round": 7,
  34.                 "duration":20,
  35.                 "break":20 //other break
  36.             }
  37.         ];
  38.  
  39.         blinds.map(function (item) {
  40.             item.duration = item.duration * 60; //convert to seconds
  41.             return item;
  42.         }).filter(function (item) {
  43.             return item.round >= 2
  44.         }).reduce(function (ac, item) {
  45.             console.log(item)
  46.             return ac;
  47.         }, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement