skip to Main Content

Javascript – filtering an object-array based on another object-array (orderly)

here is my data: arrayA= [{"studentID":1,"Type":"A"},{"studentID":2,"Type":"B"},{"studentID":3,"Type":"C"},{"studentID":4,"Type":"A"}] filteredArrayOrderlyOn = [{"studentID":1},{"Type":"A"}] (depending on the order the user selects the filters) Output should be arrayA = [{"studentID":1,"Type":"A"}] or if the filteredArrayOrderlyOn array changes because user has control on this selection. filteredArrayOrderlyOn = [{"Type":"B"},{"studentID":1}]…

VIEW QUESTION

Javascript – const data = Object.fromEntries(formData);

How to add an array to the last in this object: const formElment = document.querySelector(".form"); formElment.addEventListener("submit", (event) => { event.preventDefault(); var array = []; var checkboxes = document.querySelectorAll("input[type=checkbox]:checked"); for (var i = 0; i < checkboxes.length; i++) { array.push(checkboxes[i].value); console.log(checkboxes[i].id);…

VIEW QUESTION

How to shuffle cards in javascript?

let cards = ["A","2","3","4","5","7","8","9","10","J","Q","K"]; shuffle(cards); console.log(cards); function shuffle(array){ let currentindex = array.length; while (currentindex !=0) { let randomcards = Math.floor(Math.random()* array.length) currentindex -=1; let temp = array[currentindex]; array[currentindex] = array[randomcards]; array[randomcards] = temp} return array } My teacher taught me…

VIEW QUESTION

Javascript – Sorting an array of objects by date with some dates being null

I have a huge array of objects called steamData that look like this: { "sid": 1690, "store_url": "https://store.steampowered.com/app/1690", "store_promo_url": null, "store_uscore": 69, "published_store": "2006-10-16", "published_meta": "2006-10-16", "published_stsp": "2006-10-16", "published_hltb": "2020-04-18", "published_igdb": "2006-09-01", "image": "https://steamcdn-a.akamaihd.net/steam/apps/1690/header.jpg", "name": "Space Empires V", "description": "Space…

VIEW QUESTION
Back To Top
Search