Factorialize a number: A rando "alternative" solution

So I wanted to try to challenge myself to find a different way to solve this than I’ve seen before, and a chance to play around with Array methods. It passed the FCC tests which is cool, bc it just kind of reinforces the “fun” part of different problem solving approaches possible in JS to reach a solution.

function factorialize(num) {
let integerArray = Array.from(Array(num + 1).keys()).slice(1);
      return (num >= 0) ? integerArray.reduce((acc, val) => acc * val, 1) : undefined;

I am pretty positive that this is definitely not a cost effective/efficient way to solve it, but wanted to share.

Curious to see if anyone else came up with some random, “unordinary” algorithm to solve this?

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.