I've been dedicating myself to learning JavaScript for the past month, and I'm currently working on a web page project for educational purposes. However, I've hit a roadblock when it comes to displaying data based on the top 10% and bottom 10% of values. I have everything set up on Repl.it, you can find the link here: https://repl.it/@YevgeniyMakkoye/Task2-RE
The specific page I'm referring to is located in assets/js/getAttendance.js
Below is the code snippet that I am currently using:
var filteredMembers = [];
actove = true;
while (filteredMembers.length / jlen < 0.1 ||
!filteredMembers.length) {
for(let member of members){
filteredMembers.push(member);
}
for (let i = 0; i < arrMemberVotes.length; i++) {
if (arrMemberVotes[i] === arrMemberVotes) {
arrMemberVotes.splice(i, 1);
}
}
console.log(maxMinCalc(arrMissedVotes, false));
console.log(filteredMembers);
}
Beneath this code, you'll also find some alternative logic that I've been experimenting with. I'm looking to figure out how to display a table showing the percentage of missed votes.
In the fetchData.js file, you'll see instances where dataSenate/dataHouse
are connected directly to JSON as JavaScript Objects.
function getSenate() {
json = dataSenate,
json = json.results[0],
jlen = json.num_results,
members = json.members;
}
function getHouse() {
json = dataHouse,
json = json.results[0],
jlen = json.num_results,
members = json.members;
}
//GET ALL DATA:
function getData(counter) {
memberParty = members[counter].party;
memberState = members[counter].state;
memberSeniority = members[counter].seniority;
firstName = members[counter].first_name;
middleName = members[counter].middle_name;
lastName = members[counter].last_name;
memberVotes = members[counter].votes_with_party_pct;
missedVotes = members[counter].missed_votes;
missedVotesPerc = members[counter].missed_votes_pct;
spacer = " ";
fullName = firstName.concat(spacer, middleName, spacer, lastName);
if (fullName.includes("null") == true) {
fullName = firstName.concat(spacer, lastName)
} else {
fullName = firstName.concat(spacer, middleName, spacer, lastName)
}
}