Skip to main content

All Questions

Tagged with
1 vote
1 answer
66 views

Clarification on Computed Properties [closed]

I’m studying TypeScript and came across this pattern: type Animal = { [key: string]: number }; let Tiger: Animal = { legs: 4, age: 5, tail: 1, eyes :2 }; From what I understand, this allows adding ...
Reema's user avatar
  • 23
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"> <...
techCARE_'s user avatar
1 vote
1 answer
51 views

Attaching inner functions that use the same random number to related button click events js

I'm working on a game that will take a random object, and use that same random object for a series of questions/functions. I'm having trouble getting the next piece of code to run after clicking the &...
Christina Bohn's user avatar
1 vote
1 answer
56 views

Object is returning empty has some properties on expand it shows

I'm getting response as empty by checking Object.keys(response) it returns empty array but on expanding the response it looks like what shown below. Can someone help me to understand this? This is the ...
Afrin Athar's user avatar
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-...
Chrys G's user avatar
  • 111
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 ...
Greeso's user avatar
  • 8,309
1 vote
2 answers
56 views

How to point to an object inside an object and display it without knowing the name

How to point to an object inside an object and display it without knowing the name. I just want to display the values ​​of the objects inside person. using the if I only want to display the values ​​...
sourcechange's user avatar
0 votes
1 answer
56 views

fs.writeFile adds extra brackets to json of key=>values object in node.js

I'm trying to update one JSON file in a for loop called asynchronously. Each time I update the whole file, with 1 object. This is my very complex code after half a day of research. (I know it's too ...
Magor Menessy's user avatar
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 ...
Sen's user avatar
  • 773
0 votes
1 answer
44 views

Is my understanding of the `callback` keyword correct here?

The following code snippet is part of an exercise in which I need to guess the output of the code: let length = 4; function callback(){ console.log(this.length); } const object = { length: 5, ...
Steve's user avatar
  • 45
-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&...
DHHJ's user avatar
  • 143
0 votes
1 answer
78 views

How to prevent data loss when updating nested objects in Node.js?

I have an object called productionSheet which contains details of a plastic bag. Dimensions and other information are stored inside productionSheet.bagDetails. When my app's backend receives the ...
Alessio Canna's user avatar
1 vote
1 answer
42 views

Value from a spread object does not correctly assign the type when the type is a union [duplicate]

This is kind of a strange edge case that it took me several hours to figure out, but I don't know what typescript rule is causing it, so I'm curious if this is something I'm not aware of, or if it's a ...
Brandon Rotkel's user avatar
0 votes
0 answers
24 views

When can using Reflect in a Proxy trap cause an infinite loop?

Following the documentation on Proxies on MDN, under the example bellow, there is this disclaimer: If you use Reflect methods within a proxy trap, and the Reflect method call gets intercepted by the ...
RDU's user avatar
  • 1,081
-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 ...
Issac Alleyne's user avatar

15 30 50 per page
1
2 3 4 5
1789