超级丑陋的数字 JavaScript
超级丑数
超级丑数是所有质因数都在给定的大小为k的质数列表质数中的正数。例如,[1,2,4,7,8,13,14,16,19,26,28,32]是给定素数=[2,7,13,19]的前12个超级丑数的序列大小为4。
问题
我们需要编写一个JavaScript函数,它接受numbernum作为第一个参数,一个素数数组arr作为第二个参数。该函数应该找到并返回第(num)个超级丑陋的数字。
示例
此代码将是-
const num = 7;
const arr = [2, 7, 14, 19];
const superUgly = (num = 1, arr = []) => {
   arr.sort((a, b)=> a - b);
   const ptr = [];
   const res = [];
   for(let i=0;i输出结果控制台中的输出将是-
16
 