All Questions
18,463 questions
1
vote
1
answer
116
views
Matching Card Game using JS
*{
box-sizing: border-box;
}
.clear {
clear: both;
}
section {
border: 1px solid black;
height: 200px;
width: 50%;
float: left;
}
<!DOCTYPE html>
<html lang="en">
<...
0
votes
1
answer
77
views
How can I implement a bash function to read a JSON file, and assign all the data to variables, including arrays and objects? [duplicate]
I wanted to share a set of configuration data between powershell, python and bash. JSON is convenient for powershell and python, but bash does not have built-in support for JSON. Most bash JSON ...
1
vote
2
answers
81
views
array.prototype is being applied to a non-array object (?)
I have a library with the following addition for Array types -
Array.prototype.top = function() {
return (this.length > 0) ? this[this.length-1] : null;
}
It seems to be applied to non-...
0
votes
4
answers
71
views
Get key of an array of objects, searching by value of object property
I have an array of objects as such
const aaa = [
{id: 10, val: "xx"},
{id: 27, val: "tr"},
{id: 13, val: "ut"}
]
Now, I know how to search for an object by a value ...
0
votes
2
answers
58
views
Jsonata how to avoid auto change in order javascript
I have array of objects as sample below.
After JSONata evaluation, the order of array of object changes. string with numeric id appears before i.e id 5 appears before id 4a.
How to avoid this change ...
-6
votes
1
answer
82
views
Creating a hierarchical array of objects with many sub-levels
I have an array of objects (possible thousands) that may or not be nested (possible tens of nests). A subset of the data looks like this:
let data = [
{"id":"m1", "name&...
3
votes
2
answers
92
views
Is there an algorithm for shuffling objects in an array randomly WITHOUT utilizing Lists and Collections
I want to shuffle an array of Objects in a card game simulation.
I scrolled through many posts on here and almost all of them mention transforming the array into a list, then shuffling it using an ...
-3
votes
2
answers
81
views
How can I push to an array inside an object that is returned by a function? [closed]
I am trying to access and alter an array that is within an object that is being returned by a function. I built two mock arrays within objects (The first on its own, the second inside a function.) The ...
0
votes
1
answer
68
views
Powershell array objects type being changed to string after using .Replace(), unable to compare to another array, which also claims to contain strings
I am currently working with Exchange Online and Graph to update my company's distribution groups.
The issue I'm encountering is when dealing with external users in my environment. When I am initially ...
0
votes
2
answers
42
views
How to associate DOM elements with original array of objects
I want to update my html table by removing some rows using "Remove" button. Whenever the user clicks on the remove button, the corresponding row gets removed. I want to remove objects from &...
0
votes
2
answers
70
views
Why does my chartData output [Object], [Object] instead of { label: 'Lukáš', value: 8 } in JavaScript?
I'm working on a JavaScript project where I generate a list of employees and their respective work hours. I want to create a chart data object with the names and values of employees, but when I log ...
0
votes
2
answers
73
views
filter out object in array if object key value is null
I need to filter out objects in array if specific key value is null.(trying to learn)
const getPlayerData = async () => {
const allPlayers = await fetchData("https://api.sleeper.app/v1/...
0
votes
1
answer
44
views
React useContext(): Objects are not valid as a React child when trying to execute function in useContext() api to fetch data
I want to fetch the data by running the API in the useContext() api, basically this API gives me the number of items added in the cart and I need that number only which Im using it in Cart.js ...
0
votes
2
answers
70
views
Javascript Object, return a new array with the indexes that match the object [duplicate]
I have the following array containing object that holds details of a league venue and code.
I also have another array with just league codes.
I want to return a new array of the indexes of the league....
0
votes
1
answer
49
views
How to retrieve nested JS object and get its data by index?
I have an extensive JS object with many nested objects, eg:
data = {
sundriesIncreases : {
month1: { projectedIncrease: 1.3, actualIncrease: 1.3 },
month2: { projectedIncrease: 1.6, ...