JavaScript (nothing new, just use bigint)
ApproachReally the same as other solutions out there, but if you dont understand why your solution doesnt work it might be because of the 'number' primitive not


# Approach
Really the same as other solutions out there, but if you dont understand why your solution doesnt work it might be because of the 'number' primitive not being able to properly deal with huge numbers, so use BigInt


# Code
```typescript []
function maximumOr(nums: number[], k: number): number {

    // precompute arrays that store the bitwise sum excluding index i
    let bitwiseBefore = [];
    for (let i = 0; i<nums.length; i++) {
        if (i == 0) {
            bitwiseBefore.push(0);
        }
        else {
            bitwiseBefore.push(bitwiseBefore[i-1] | nums[i-1]);
        }
    }

    let bitwiseAfter = Array(nums.length).fill(0);
    for (let i = nums.length-1; i>= 0; i--) {
        if (i == nums.length-1) {
            continue;
        }
        else {
            bitwiseAfter[i] = bitwiseAfter[i+1] | nums[i+1];
        }
    }

    let power = BigInt(1);
    for (let i = 0; i<k; i++) {
        power = power * BigInt(2);
    }
        let maxValue = BigInt(0);

    for (let j = 0; j<nums.length; j++) {
            let val = BigInt(nums[j]) * power;
            let orSum = BigInt(bitwiseBefore[j]) | val | BigInt(bitwiseAfter[j]);
            if (orSum > maxValue) {
                maxValue = orSum;
            }
    }

    return Number(maxValue);
};
```
['TypeScript', 'JavaScript']