CIDR to netmask conversion in javascript

I found some code in PHP to convert CIDR to netmask.

function createNetmaskAddr($bitcount) {
   $netmask = str_split(str_pad(str_pad('', $bitcount, '1'), 32, '0'), 8);
   foreach ($netmask as &$element) $element = bindec($element);
   return join('.', $netmask);

Is it possible to do it in javascript?

Unfortunately I have no experience in javascript.

209 thoughts on “CIDR to netmask conversion in javascript”

  1. I know this site gives quality based articles or reviews and additional stuff, is
    there any other web page which presents such information in quality?

  2. I simply couldn’t go away your site before suggesting that I really enjoyed the standard info a person supply for your visitors? Is going to be again continuously to check out new posts.

  3. Greetings from Los angeles! I’m bored at work so I
    decided to check out your site on my iphone during lunch break.
    I love the info you provide here and can’t wait to take a look when I get home.
    I’m shocked at how quick your blog loaded on my phone ..

    I’m not even using WIFI, just 3G .. Anyways, superb site!

  4. I am no longer sure where you are getting your info, however good topic.
    I must spend a while finding out more or understanding more.

    Thank you for magnificent info I used to be looking for this information for my mission.

  5. An outstanding share! I have just forwarded this onto
    a co-worker who had been doing a little homework on this.
    And he in fact ordered me breakfast due to the fact that I discovered it for him…
    lol. So let me reword this…. Thanks for the meal!!

    But yeah, thanks for spending some time to talk about this issue here on your website.

  6. Fantastic beat ! I wish to apprentice at the same time as you amend your web
    site, how can i subscribe for a weblog website?
    The account helped me a appropriate deal. I have been tiny bit familiar of this your broadcast provided vibrant transparent idea

  7. Have you ever thought about adding a little bit more than just your articles?
    I mean, what you say is important and everything.
    But imagine if you added some great images or video clips to give
    your posts more, “pop”! Your content is excellent but with pics and
    videos, this blog could definitely be one of the best in its field.
    Fantastic blog!

  8. Hey I know this is off topic but I was wondering if you knew of
    any widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping
    maybe you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.
    quest bars quest bars

  9. I am not positive where you are getting your information, however good topic.
    I must spend a while finding out more or understanding more.

    Thanks for wonderful info I was in search of this info for my mission.

  10. I as usual close my recipe at Walgreens but they were gone from of the medication I needed, so I tried azithromycin without a vets prescription. They had my medication, were very brisk, comradely, knowledgeable and much easier to give out with than Walgreens. My recipe was filled in less than 10 minutes, where Walgreens takes at the certainly least 1.5 hours. I was so impressed alongside the way they treated me that they will have an impact my matter from now on, no more Walgreens!

  11. Simply wish to say your article is as amazing. The clearness for your
    submit is simply great and i could suppose you are a professional in this
    subject. Fine along with your permission allow me to snatch
    your RSS feed to keep up to date with approaching post.
    Thanks 1,000,000 and please keep up the rewarding work.

  12. It’s actually very difficult in this active life to listen news
    on TV, therefore I just use internet for that purpose, and take the most
    recent news.

  13. Hello There. I found your blog using msn. This is a really
    well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks
    for the post. I will definitely comeback.

  14. We’re a group of volunteers and starting a new scheme
    in our community. Your web site offered us with valuable info to work on. You have done a formidable
    job and our entire community will be grateful to you.


Leave a Comment