将Python中的行转换为JavaScript:[(M[i],k//M[i])]

2024-04-26 09:18:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试将以下脚本翻译成JavaScript。有一行我不知道它是做什么的,我怀疑它会推到数组中

def greedyCoinChanging(M, k):
    n = len(M)
    result = []
    for i in xrange(n - 1, -1, -1):
        result += [(M[i], k // M[i])] // <-- what the hell is this in JavaScript?
        k %= M[i]
    return result

Tags: thein脚本forlenisdef数组