leetcode product of array except self

Run Settings
LanguageJavaScript
Language Version
Run Command
console.log("Hello World!");/** * @param {number[]} nums * @return {number[]} */ var productExceptSelf = function(nums) { //navie let products = []; for(let i=0;i<nums.length;i++) { let product = 1; for(j=0;j<nums.length;j++) { if(i!=j) product *= nums[j]; } products.push(product); } return products; }; console.log(productExceptSelf([1,2,3,4]))
Editor Settings
Theme
Key bindings
Full width
Lines