encho253

Untitled

Jan 27th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sum(param) {
  2.     let result = 0;
  3.     for (let i = 0; i < param.length; i += 1) {
  4.         if (typeof param[i] == 'function') {
  5.             result += param[i]();
  6.         }
  7.         if (!Number.isNaN(Number(param[i]))) {
  8.             result += param[i];
  9.         }
  10.     }
  11.  
  12.     console.log(result);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment