Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
reduce is the way solution in Creative category for Multiply (Intro) by putraridho
import assert from "assert";
function multTwo(a: number, b: number): number {
return Array(b).fill(a).reduce((acc, x) => acc + x, 0)
}
console.log('Example:');
console.log(multTwo(3, 2));
// These "asserts" are used for self-checking
assert.equal(multTwo(3, 2), 6);
assert.equal(multTwo(0, 1), 0);
console.log("Coding complete? Click 'Check' to earn cool rewards!");
June 5, 2020
Comments: