blob: a15695e97b969b6f0be656b045bd5703d25a25b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//![0]
// factorial.mjs
export function factorial(a) {
a = parseInt(a);
if (a <= 0)
return 1;
else
return a * factorial(a - 1);
}
//![0]
|