/**
* @param {number[]} nums
* @return {number[]}
*/
var productExceptSelf = function(nums) {
let left = 1;
let right = 1;
const len = nums.length;
let ret = [];
for(let i = 0; i<len; i++){
ret[i] = left;
left *= nums[i]
}
for (let j = len - 1; j>= 0; j--){
ret[j] *= right;
right *= nums[j]
}
return ret;
};