All Questions
12,000 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">
<...
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
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
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
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, ...
0
votes
2
answers
60
views
Javascript Array Object, return result in correct order
I have a created a array object. To simplify it I have just kept two fields, id and name.
I want to filter the mainArray and return the result in the order of the [3,9,1] as seen in the filterArray ...
0
votes
0
answers
126
views
How to use fast-xml-parser's arrayMode to parse only one element into JSON Array instead to JSON object
I have the played around with following XML-snippet(contents might not be correct but to highlight my question):
My problem is that if I only have one entry (as in layoutsX) the value inside this tag ...
1
vote
6
answers
88
views
Flatten the array of objects and removing duplicate key entry
I have array of objects data as below where ID is duplicate key in nested array of object:
const arr = [
{
"First Name": "ABC",
"Last Name": "...
1
vote
2
answers
29
views
Return, object property "undefined" "Cannot GET /src/html/undefined" on a Link
within the return statement there is a link element that has an object property as its value/href.
This link is wrapped around each item in my array. When the link is clicked "Cannot GET /src/...
1
vote
2
answers
67
views
how to change array of object based on condition using javascript
I would like to know how to shift based on field that contains numeric string and normal string.
so, if numeric string value then shift to end of array, rest remain same
Tried
const sortData = arrobj....