Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7060825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:23:57+00:00 2026-05-28T04:23:57+00:00

Got issue My javascript array contains dates for ex. 19.4.2003,28.11.1997,3.1,,29.6,7.11.2008 (date-month-year). As you can

  • 0

Got issue
My javascript array contains dates
for ex. 19.4.2003,28.11.1997,3.1,,29.6,7.11.2008 (date-month-year).
As you can see some of dates are missing ( just ,, ) and some are without a year (for ex. 29.6).
The array above should looks like: 19.4,28.11,3.1,,29.6,7.11
Then I need to find an element and get its index with jQuery.inArray("searchVar", myArr);
The code is below

if (data.response) { //response from social network
    var f_cnt = data.response.length;
    for(var i=0;i<f_cnt;i++) { 
        holidaysArr.push(data.response[i].bdate); //pushing date in array
        //modify in loop? or call function to modify later?
    }
    holidaysLoaded=true; // just flag
}       

Pushing (ok) -> modifying -> searching for element.
Need your help.

UPDATE
While making project understand I need to call social network API more than once so saved data in my array. Check it:

    if (data.response) {
    friends_data = data.response.sort(sFirstName); //sorting nvm
    f_cnt = data.response.length; //count of arrayfields
    holidaysLoaded=true;    //flag
}

So array has uid, first_name, last_name, bdate atm. Not just bdate as hour ago.
Question is: How to modify all friends_data[i].bdate with match? Empty birthdays have undefined atm. I think I need something like

for(var i=0;i<f_cnt;i++){
   friends_data[i].bdate = cutFunc(friends_data[i].bdate);
}

and form cutFunc(param) with checking on undefined, if not it will match with your function?

UPDATE 2 cutFunc should be smth like this:

function cutFunc(param) {
if(param==undefined) return
else return param.match(/\d+\.\d+/g);
}

thank you 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:23:58+00:00Added an answer on May 28, 2026 at 4:23 am

    This gets a holiday array with just days.month

    if (data.response) { //response from social network
        var f_cnt = data.response.length;
        for(var i=0;i<f_cnt;i++) { 
            holidaysArr.push(data.response[i].bdate); //pushing date in array
            //modify in loop? or call function to modify later?
        }
              holidaysArr = (holidasArr.join(',')).match(/\d+\.\d+/g);
        holidaysLoaded=true; // just flag
    }
    

    EDIT Sorry the regex was wrong; it’s been modified with correct regex


    EDIT Here’s a JSFiddle Link


    EDIT Updated the JSFiddle Link

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

recently got an issue when loading vs 2008, it displays this... can anyone tell
Hello folks, I've got the issue to add a browser event to some input
I'm having a javascript issue I can't figure out. I've taken a snippet of
I've got a strange issue with decoding an escaped javascript string. Here is the
I got a JavaScript code I wrote that calls a web service returns some
So I'm having a cross-browser JavaScript issue. I've got a <select> DOM element that
I got an issue that negation of zero produces false in my JavaScript code.
I've got this crazy javascript issue with IE7 and IE8. The function expression below
I've got an issue similar to this question here: Javascript and AJAX, only works
I've started to use GeckoFX but I got a major issue with javascript:void(0) that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.