Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. That's one way to do it

That's one way to do it

Scheduled Pinned Locked Moved The Weird and The Wonderful
comhelp
64 Posts 38 Posters 39 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Kent Sharkey

    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

    M Offline
    M Offline
    Member 9167057
    wrote on last edited by
    #15

    Well, if you troll, then you might just as well do it right, walking the walk way to the end.

    K 1 Reply Last reply
    0
    • P Peter_in_2780

      Brisingr Aerowing wrote:

      42 MEGABYTES OF JAVASCRIPT?!

      Meh. It'll get lost in the framework(s) downloaded with it.

      Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

      J Offline
      J Offline
      JohaViss61
      wrote on last edited by
      #16

      It's at 94.8MB now

      M 1 Reply Last reply
      0
      • K Kent Sharkey

        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

        K Offline
        K Offline
        KateAshman
        wrote on last edited by
        #17

        In all seriousness, it also tells if a written number is even or odd. I've seen worse.

        Richard DeemingR 1 Reply Last reply
        0
        • K KateAshman

          In all seriousness, it also tells if a written number is even or odd. I've seen worse.

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #18

          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. :-D


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          1 Reply Last reply
          0
          • K Kent Sharkey

            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

            P Offline
            P Offline
            Peter Kelley 2021
            wrote on last edited by
            #19

            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? :)

            Richard DeemingR 1 Reply Last reply
            0
            • K Kent Sharkey

              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

              S Offline
              S Offline
              Slow Eddie
              wrote on last edited by
              #20

              What? :confused: I am probably dumb, or inexperienced, or both, but I see no practical use for this.:confused:

              Zaphod

              1 Reply Last reply
              0
              • K Kent Sharkey

                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

                S Offline
                S Offline
                Slow Eddie
                wrote on last edited by
                #21

                What? :confused: I am probably dumb, or inexperienced, or both, but I see no practical use for this.:confused:

                1 Reply Last reply
                0
                • P Peter Kelley 2021

                  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? :)

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #22

                  Feel free to suggest it[^]. :laugh:


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                  1 Reply Last reply
                  0
                  • K Kent Sharkey

                    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

                    E Offline
                    E Offline
                    englebart
                    wrote on last edited by
                    #23

                    Thanks for sharing this… I was looking for a way to stripe my html tables!

                    1 Reply Last reply
                    0
                    • K Kent Sharkey

                      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

                      A Offline
                      A Offline
                      atverweij
                      wrote on last edited by
                      #24

                      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.

                      D B B K 4 Replies Last reply
                      0
                      • A atverweij

                        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.

                        D Offline
                        D Offline
                        dandy72
                        wrote on last edited by
                        #25

                        Points for being clever. Sadly, someone would still use it...

                        A 1 Reply Last reply
                        0
                        • K Kent Sharkey

                          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

                          M Offline
                          M Offline
                          MarkTJohnson
                          wrote on last edited by
                          #26

                          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.

                          W D 2 Replies Last reply
                          0
                          • K Kent Sharkey

                            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

                            K Offline
                            K Offline
                            Kirk 10389821
                            wrote on last edited by
                            #27

                            You know... It's 2021, and the IRONY flows freely in all things... I expected to see a macro (written in JavaScript), that writes the javascript file: for (x..) if x % 1 == 0 write "if (number == " + x +") return false;" else write "if (number == " + x +") return true;" == And to see him asking people to crowd source running that file, to help him out! == Next question... Where is his test harness... Or is he caught in an infinite loop?

                            1 Reply Last reply
                            0
                            • D dandy72

                              Points for being clever. Sadly, someone would still use it...

                              A Offline
                              A Offline
                              atverweij
                              wrote on last edited by
                              #28

                              If someone really uses it, he or she deserves it ;P

                              D 1 Reply Last reply
                              0
                              • M MarkTJohnson

                                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.

                                W Offline
                                W Offline
                                wapiti64
                                wrote on last edited by
                                #29

                                I'd side with JSOP, after I made them delete everything.

                                1 Reply Last reply
                                0
                                • K Kent Sharkey

                                  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

                                  J Offline
                                  J Offline
                                  John Wellbelove
                                  wrote on last edited by
                                  #30

                                  They've missed a whole set of entries for those that speak British style English. American: Thirty-Two Thousand One Hundred Twelve British: Thirty-Two Thousand One Hundred And Twelve I'd better get editing...

                                  Richard DeemingR M 2 Replies Last reply
                                  0
                                  • A atverweij

                                    If someone really uses it, he or she deserves it ;P

                                    D Offline
                                    D Offline
                                    dandy72
                                    wrote on last edited by
                                    #31

                                    Sometimes the best thing you can do is let others hang themselves. Figuratively speaking. :~

                                    1 Reply Last reply
                                    0
                                    • J John Wellbelove

                                      They've missed a whole set of entries for those that speak British style English. American: Thirty-Two Thousand One Hundred Twelve British: Thirty-Two Thousand One Hundred And Twelve I'd better get editing...

                                      Richard DeemingR Offline
                                      Richard DeemingR Offline
                                      Richard Deeming
                                      wrote on last edited by
                                      #32

                                      Someone's already beaten you to that suggestion: [Feature Request] Support for British English "and" · Issue #85 · samuelmarina/is-even · GitHub[^] :-D


                                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                                      N 1 Reply Last reply
                                      0
                                      • A atverweij

                                        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.

                                        B Offline
                                        B Offline
                                        BruceCarson
                                        wrote on last edited by
                                        #33

                                        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.

                                        A 1 Reply Last reply
                                        0
                                        • B BruceCarson

                                          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.

                                          A Offline
                                          A Offline
                                          atverweij
                                          wrote on last edited by
                                          #34

                                          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 ;P EDIT: because I get serious reactions on this code The code above is how NOT to do it - it's satire.

                                          B K 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups