That's one way to do it
-
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 :laugh: EDIT: because I get serious reactions on this code The code above is how NOT to do it - it's satire.
hope your happy!!
-
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.. 🤩🤩🤩🤩
-
..yes..is there anything else i should be serious about?.. 🤪🤪🤪🤪
-
Now the question is... Is the one with that request trolling him? Or does he really needs it for his usage?
M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
..got it perfectly..but are we on the same page? really?.. 😇😇😇😇
-
Daniel Pfeffer wrote:
I'd then cordon off the area and decontaminate everything he touched on his visit - in an autoclave, by choice
Anything wrong with fire?
Wrong is evil and must be defeated. - Jeff Ello
..better be ready..you cant fight fire with fire.. ..you might be burned.. ..were you?.. 🤠🤠🤠ðŸ¤
-
..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".
-
GitHub - samuelmarina/is-even[^]
Quote:
This is a 100% serious project, and it is made to help the community.
A brief excerpt:
function isEven(number) {
if(number === 1) return false;
else if(number === 2) return true;
else if(number === 3) return false;
else if(number === 4) return true;
else if(number === 5) return false;
else if(number === 6) return true;
else if(number === 7) return false;They're up to 1,000,001 now. Help them grow! :doh:
TTFN - Kent
-
It's at 94.8MB now
Don't waste my time, hahaha! :laugh:
-
I... what?! I thought you were joking for a second but there actually is a definition for even and odd in generic bases. In even bases it's the last-digit test - odd is odd, even is even; in odd bases it's a test of the sum of all digits - odd is odd, even is even. That makes complete sense; it's just not something I've ever considered :omg:
-
GitHub - samuelmarina/is-even[^]
Quote:
This is a 100% serious project, and it is made to help the community.
A brief excerpt:
function isEven(number) {
if(number === 1) return false;
else if(number === 2) return true;
else if(number === 3) return false;
else if(number === 4) return true;
else if(number === 5) return false;
else if(number === 6) return true;
else if(number === 7) return false;They're up to 1,000,001 now. Help them grow! :doh:
TTFN - Kent
They could even have used a switch statement. Odd that they didn't think of that :)
Check out my blog at http://msdev.pro/
-
GitHub - samuelmarina/is-even[^]
Quote:
This is a 100% serious project, and it is made to help the community.
A brief excerpt:
function isEven(number) {
if(number === 1) return false;
else if(number === 2) return true;
else if(number === 3) return false;
else if(number === 4) return true;
else if(number === 5) return false;
else if(number === 6) return true;
else if(number === 7) return false;They're up to 1,000,001 now. Help them grow! :doh:
TTFN - Kent
I feel the power of Javascript infusing me! :laugh:
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
-
Only works with base-10 ? :-D Surely it would be better written recursively.
PIEBALDconsult wrote:
Only works with base-10 ?
You just need to add conversion functions and call them first.
function hexToDec(number) {
if (number === 1) return 1;
else if (number === 2) return 2;
//...
else if (number === A) return 10;
else if (number === B) return 11;
//...
}Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius