Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function arrays(array1, array2) {
- let sum =0;
- let isRight = true;
- for (let hmm = 0; hmm <= array1.length-1; hmm++) {
- array1[hmm]=Number(array1[hmm]);
- array2[hmm]=Number(array2[hmm]);
- sum+=(array1[hmm]);
- if (array1[hmm] !== array2[hmm]) {
- let thisNumber = (hmm);
- console.log('Arrays are not identical. Found difference at ' + thisNumber + ' index');
- isRight = false;
- break;
- }
- }
- if (isRight === true) {
- console.log('Arrays are identical. Sum: ' + Number(sum));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement