locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
13 lines (12 loc) • 512 B
JavaScript
import { pythonMul } from "../_helpers/_operator.js";
export function mul(a, b) {
// discuss at: https://locutus.io/python/operator/mul/
// parity verified: Python 3.12
// original by: Kevin van Zonneveld (https://kvz.io)
// note 1: Multiplies numbers and repeats strings or arrays like Python's operator.mul.
// example 1: mul(6, 7)
// returns 1: 42
// example 2: mul('ha', 3)
// returns 2: 'hahaha'
return pythonMul(a, b, 'mul');
}