Ask your JavaScript questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

count each player's number of games played within the date range. JavaScript

  • SOLVED

task is to count each players number of games played. if they haven't played a minimum of 10 games then they can't play in the club championship. web site = http://verlager.com/cccr_Ch.php


<script>
games_archive =

[
{ "name": "Ahmed, Jamshed", "date": "2020-05-01" },
{ "name": "Attaya, James J", "date": "2020-01-15" },
{ "name": "Badamo, Anthony", "date": "2019-11-14" },
{ "name": "Bakht, Omar", "date": "2019-03-06" },
{ "name": "Birmingham, Gerald R", "date": "2019-07-25" },
{ "name": "Blazak, Stephen A", "date": "2020-04-02" },
{ "name": "Bonaparte, John R", "date": "2019-05-01" },
{ "name": "Brown, Chris", "date": "2019-10-02" },
{ "name": "Burnside, Dan", "date": "2020-06-11" },
{ "name": "Cavanaugh, Michael P", "date": "2019-08-25" },
{ "name": "Chadwick, Daniel R", "date": "2018-03-21" },
{ "name": "Connelly, Michael D", "date": "2020-03-06" }
{ "name": "Ahmed, Jamshed", "date": "2020-05-10" },
{ "name": "Attaya, James J", "date": "2020-01-10" },
{ "name": "Badamo, Anthony", "date": "2019-11-13" },
{ "name": "Bakht, Omar", "date": "2019-03-06" },
{ "name": "Birmingham, Gerald R", "date": "2019-07-22" },
{ "name": "Blazak, Stephen A", "date": "2020-04-08" },
{ "name": "Bonaparte, John R", "date": "2019-05-14" },
{ "name": "Brown, Chris", "date": "2019-10-21" },
{ "name": "Burnside, Dan", "date": "2020-06-19" },
{ "name": "Cavanaugh, Michael P", "date": "2019-08-26" },
{ "name": "Chadwick, Daniel R", "date": "2018-03-27" },
{ "name": "Connelly, Michael D", "date": "2020-03-09" }
];

</script>

<form action="javascript:add_list()" method="post" name="late_to_party" id="ex2" >

<fieldset>

<label>START_DATE</label>
<input type="text" name="name" id="wood" >

<label>STOP_DATE</label>
<input id="chuck" autocomplete = "off" />

<label>MIN_GAMES</label>
<input id="cat" />
<input type="submit" id = "wrapup" value="{CALCULATE}">


</fieldset>

</form>

tuple = player_name date_of_game ... ... = (total number of games played)

sample output:

<div>Ahmed, Jamshed 2020-05-01 2020-05-10 =2 </div>

<div>Attaya, James J 2020-01-15 2020-01-10 =2 </div>

Answers (1)

2019-08-03

Rainner Lins answers:

Looking into it, give me a few minutes...


Rainner Lins comments:

Ok, check if this is what you are looking for:

https://jsfiddle.net/rainnerlins/8ywrjfL7/

I had to reorganize your html a bit and rename a few things. The inputs are type=date, which gives you a data picker, but might not be supported in all browers, might want to look into that later to make sure the value entered is a valid date string.


User180435 comments:

The js at https://jsfiddle.net/rainnerlins/8ywrjfL7/ contains duplicate data. Could you please fix this for me?


User180435 comments:

My bad... you were right.


User180435 comments:

Your code doesn't appear to do anything. Check https://verlager.com/test.html


Rainner Lins comments:

Try putting the HTML code before the JS code.