Whenever I think has no more betrayals left to inflict on me, I discover another:

`[4] * 3`, that is, an array containing a number, multiplied by a number, returns… 12, another number.

I think my mistake is thinking JavaScript is a tsundere and some day I’ll get the dere. Maybe JavaScript is the of programming languages—just a giraffe traitor 😤

@22 Did you expect that it would output 4, three times?

@bthall No, I actually expected an error to be thrown—with such conviction that I wrote a unit-test assuming it would throw and scratched my head why `tape` was saying it didn't catch any thrown exceptions 😂

@22 😂 I think it works in a similar way as #Rlang deals with rows of numbers being multiplied. Maybe test adding in a second number to the array to see if it'll output both numbers multiplied by 3? 🤓

@bthall Alas, it's not nearly as cool as R. Arithmetic will convert only single-element arrays to scalars. Multiplying a two-element array with a scalar number results in … NaN. Still shaking my head.

Sign in to participate in the conversation

Octodon is a nice general purpose instance. more