|
Well, if you troll, then you might just as well do it right, walking the walk way to the end.
|
|
|
|
|
..lead the way please..
..you will be lost first..
🤩🤩🤩🤩
|
|
|
|
|
That reminds me on that Simpsons episode. The boys hop into the caravan to steal back the lemon tree stolen by Shelbyvillians. After running through Shelbyville for basically ever, someone asks Homer, where he leads them. "I was following Flanders".
|
|
|
|
|
In all seriousness, it also tells if a written number is even or odd.
I've seen worse.
|
|
|
|
|
That just means the package is doing too much. Converting words to numbers should be separated out into its own package, since it's nothing to do with the purpose of the is-even package.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm sure this project is a gag! (and I'm snickering!)
Has anyone yet suggested porting this to some cloud-native database of the even numbers?

|
|
|
|
|
Feel free to suggest it[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
What? I am probably dumb, or inexperienced, or both, but I see no practical use for this.
Zaphod
|
|
|
|
|
What? I am probably dumb, or inexperienced, or both, but I see no practical use for this.
|
|
|
|
|
Thanks for sharing this… I was looking for a way to stripe my html tables!
|
|
|
|
|
That can be done better with a recursive function:
function IsEven(number) {
if (number === 1 return false;
elseif (number === 2) return true;
else return IsEven(number - 2);
}
Now it does all positive numbers
EDIT: because I get serious reactions on this code
The code above is how NOT to do it - it's satire.
modified 20-Aug-21 8:19am.
|
|
|
|
|
Points for being clever.
Sadly, someone would still use it...
|
|
|
|
|
If someone really uses it, he or she deserves it 
|
|
|
|
|
Sometimes the best thing you can do is let others hang themselves.
Figuratively speaking.
|
|
|
|
|
No...only positive integers. Since this is JS, some jerk could pass a float in and get your recursive function to march off the negative end of the numbers.
|
|
|
|
|
Hmmm, you are right.
The the improved improved version.
function IsEven(number) {
if (number === 1) return false;
else if (number ===2) return true;
else if (number > 2) return IsEven(number - 2);
else return IsEven(number + 2)
}
Now it does negatives too
EDIT: because I get serious reactions on this code
The code above is how NOT to do it - it's satire.
modified 20-Aug-21 8:19am.
|
|
|
|
|
And now this line of code is used:
IsEven (4.2);
It'll bounce around 0 until the heat death of the universe.
|
|
|
|
|
You are taking this code seriously?
|
|
|
|
|
..yes..is there anything else i should be serious about?..
🤪🤪🤪🤪
|
|
|
|
|
Why are all the 'else's there? Do they improve code generation?
|
|
|
|
|
No, they worsen it 
|
|
|
|
|
With big number (I mean really big numbers), you will run into a StackOverflowException.
What about "tail recursion"?
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
|
|
I'm trying to guess what certain CPers would do if they were confronted with this person.
JSOP - bullet in the guy's head to put both the guy and everyone else out of their misery.
honey the codewitch - After she quit twitching, she'd write a parser to optimize the code.
OriginalGriff - figures out how to turn it into a CCC clue
Nagy - just wanders off, asking where the gin is.
Me - I'd tell him to turn it all into a switch statement.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|