As you can see from the embed below... my script is only returning one result(500). How can I rewrite my code so that I get both results? Thank you in advance for your advice.
A function can only return one thing. A generator function (function*
) however can yield as many numbers as you want:
function* multiplier() {
yield 25 * 20;
yield 25 * 1;
}
console.log(...multiplier())
You could also turn the results into an array easily:
const array = [...multiplier()];
(No this is not the easiest way, but im trying to propagate some cool js :))