patcko

Untitled

Dec 17th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var x = 5,
  2. y = 5,
  3. arr = [],
  4. add;
  5. for (i = 0; i < x; i++) {
  6. arr[i] = new Array();
  7. for (j = 0; j < y; j++) {
  8.     arr[i][j] = Math.round(Math.random() *(10 - 1) + 1);
  9. }
  10. if (add === undefined) {
  11.     add = arr[i][i]
  12.     console.log('1st add = ' + add);
  13. } else {
  14.     add *= arr[i][i]
  15. }
  16. }
  17. console.log(add);
  18. console.log(arr);
Advertisement
Add Comment
Please, Sign In to add comment