Ad
Fundamentals
Arrays
Data Types
Code
Diff
  • function findOnly(arr) {
      let result = 0;
      arr.forEach((i) => {
        result = i ^ result;
      });
      return result;
    }
    • function getSum(array) {
    • return array.reduce((total, num) => total += num);
    • function findOnly(arr) {
    • let result = 0;
    • arr.forEach((i) => {
    • result = i ^ result;
    • });
    • return result;
    • }