All Questions
169
questions
0
votes
1
answer
43
views
getting error when modifying the javascript property using Object.defineProperty()
obj = [{
prop11: 'value1',
prop21: 'value2'
},
{
prop12: 'value1',
prop22: 'value2'
},
{
key3: {}
}
];
obj.forEach(element => {
Object.defineProperty(obj.key3, '...
-1
votes
1
answer
24
views
I am trying a display items (events) from db typescript nestjs using handlebars the events are an array of object. Properties of each object undefined
please look at the way i am passing the events check for the issue
@Get('views/users/events')
async findAllEvents(
@Req() req: Request,
@Res() res: Response,
@Query('page') page: number = 1,
@Query(...
0
votes
0
answers
16
views
powershell array of object with dynamic properties outputs only properties from first element [duplicate]
why ? and how to fix this ? how to export to csv file now after export i receive the same as when displaying $res.
$res= @()
$obj = [PSCustomObject]@{}
$obj | Add-Member -MemberType NoteProperty -Name ...
0
votes
1
answer
32
views
Explanation on access an object property that does not exist on an DOM element
I am a beginner on JavaScript, looking for a explanation on accessing to an object property that does not exist on an DOM element.
I am working on a todo apps. Below is my current code but it is not ...
0
votes
4
answers
90
views
How can I write a function that returns the objects in an array that have the two same property values?
Let's say I have the following object:
const myObjects = [
{ name: "Alice", age: 30 },
{ name: "Bob", age: 25 },
{ name: "Alice", age: 30 },
{ name: "...
0
votes
1
answer
20
views
I've been trying this code for a for loop inplementing an array into it
const jonas = {
firstName: 'Jonas',
lastName: 'Billing',
age: 2037-1991,
job: 'teacher',
friends: ['Michael', 'Peter', 'Steven']
};
const types = [];
for (let i = 0; i < jonas.length; i++) {
...
0
votes
0
answers
33
views
Why can't I access a property of an object in a loaded array of objects in typescript?
So, I cannot wrap my mind around this problem...
Basically, I have some variables and a constructor in a class:
currentUser: UserModel | null = null;
currentServer: ServerModel | null = null;
...
0
votes
2
answers
96
views
I want to filter an array of objects through an object property
I´m new to Javascript, I´m trying to filter an array of objects through one of the object properties (to get the object that has the biggest value of said property. How would I go about to doing that?
...
0
votes
2
answers
43
views
Deleting an object from an array and changing one of its properties simultaneously - javascript
I have this array of objects:
const flights = [
{ id: 00, to: "New York", from: "Barcelona", cost: 700, scale: false },
{ id: 01, to: "Los Angeles", from: "...
0
votes
4
answers
315
views
How to get first properties of each object in an array of objects?
const combinations = [{rolledOnes: true, scoredOnes:false},
{rolledTwos: true, scoredTwos:false}];
I am fairly new to Javascript. So, my actual array is larger than this. I ...
-1
votes
1
answer
74
views
Adding values to object inside array not working - cannot set property of undefined
I am trying to transform a JSON that was build from a CSV file
[
{
"id_familia": 15,
"relacao": 1,
"occupation": "RESPONSAVEL",
&...
0
votes
2
answers
38
views
Replacing similar items of an array from the objects value
There's an object below named cricket mania consisting of net runs and points scored by different countries. I am trying to write a code in JS to sort the teams according to their Points first, and if ...
0
votes
1
answer
162
views
Match elements of properties in objects in JavaScript
I've been trying to compare all the series from my objects with the corresponding genre. I managed to display them but I'm practically writing the same code three times, while I'm sure there is a ...
0
votes
0
answers
16
views
Is there a way to stop edits of specific properties in an object? [duplicate]
I am building out a shopping cart component and have a function to add new items. My object structure looks like so:
productsArray = [{
"item": {
"id": 001,
"...
0
votes
2
answers
291
views
assign property to object in array
I know there are a lot of questions like this and this is probably a duplicate, but be sure, i tried every single solution provided to these questions and none of them worked for me.
Here's the thing:
...