Hi, thank you for your response. Of course, I know about the modulo operator. This challenge was supposed to be about your worst programs. And as an example I posted this function that divides two numbers, casts the result to a string, searches the whole string for a comma and returns whether a comma was found or not instead of just using %. This is pretty bad in my view. I thought you (the community) might have some other terrible examples like this.
Can I suggest an improvement to your program? It turns out that there is an operator for doing exactly that in JavaScript.
The modulo operator retrieves the remainder of division, which is always 0 for whole multiples.
Hi, thank you for your response. Of course, I know about the modulo operator. This challenge was supposed to be about your worst programs. And as an example I posted this function that divides two numbers, casts the result to a string, searches the whole string for a comma and returns whether a comma was found or not instead of just using
%
. This is pretty bad in my view. I thought you (the community) might have some other terrible examples like this.Ohhhhh. I definitely missed that nuance in your original question. My mistake.