Easy O(n) JS Solution
\nvar nthSuperUglyNumber = function(n, primes) {\n    let nums = [1], indices = new Array(primes.length);\n    for (let i = 0; i < indices.length; i++) indices[
```\nvar nthSuperUglyNumber = function(n, primes) {\n    let nums = [1], indices = new Array(primes.length);\n    for (let i = 0; i < indices.length; i++) indices[i] = 0;\n    while (nums.length < n) {\n        let next = Number.MAX_VALUE, minIndices = [];\n        for (let i = 0; i < primes.length; i++) {\n            let num = nums[indices[i]]*primes[i];\n            if (next > num) {\n                next = num;\n                minIndices = [i];\n            } else if (next == num) minIndices.push(i);\n        }\n        nums.push(next);\n        minIndices.forEach(j => indices[j]++);\n    }\n    return nums[n-1];\n    // Time Complexity: O(n)\n    // Space Complexity: O(n)\n};\n```
['JavaScript']