Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(arr1, arr2) {
- let sum = 0;
- for (let i in arr1) {
- if (arr1[i] !== arr2[i]) {
- console.log(`Arrays are not identical. Found difference at ${i} index`);
- return;
- }
- sum += arr1[i] - 0; //ASCII hack
- }
- console.log(`Arrays are identical. Sum: ${sum}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment