Guest User

Untitled

a guest
Jan 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. var ancestry = JSON.parse(ANCESTRY_FILE)
  2. var idadeMaesTiveramFilho = []
  3.  
  4. function average(array) {
  5. function plus(a, b) { return a + b; }
  6. return array.reduce(plus) / array.length;
  7. }
  8.  
  9.  
  10. function HasMotherKnow(obj){
  11. if(obj.mother != null){
  12. const nomeMae = obj.mother;
  13. const dataNascimentoFilho = obj.born;
  14. ancestry.forEach(function(pessoinha){
  15. if (pessoinha.name === nomeMae){
  16. idadeMaesTiveramFilho.push(dataNascimentoFilho - pessoinha.born)
  17. }
  18. })
  19. }
  20. }
Add Comment
Please, Sign In to add comment