All Questions
Tagged with object properties
1,192
questions
0
votes
1
answer
64
views
Count number of filled properties of object with objects
I need to make a percentage of fields filled in a form, which is stored in an object.
For that I need the number of filled fields and the total number of fields.
Let's say I've this object (7 ...
0
votes
1
answer
2k
views
PHP check if object exists and get it's property in one line
I am wondering if there is in php7.3/php7.4 somehow possible to check inline if and object exists and if yes then get it's property like nullsafe operator. Like this it returns error:
$object = null;
...
3
votes
2
answers
6k
views
Typescript - How to access a variable object property from a variable object
I'm having some difficulty trying to write a function that takes two inputs:
The name of an object
The name of a property
and prints the value of that property for that object. However, the objects ...
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: "...
-1
votes
1
answer
44
views
Javascript - How using a variable for object property
Im very beginner in javascript, i would like to use all variable created on each object property :
let title = "Les Miserables";
let resume = "Blabla blaaabla...";
let autor = &...
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
742
views
How to dynamically handle changes in a JSON object name that may change regularly, when building C# class to deserialize the JSON? [closed]
my predicament is that I have to deserialize some JSON files provided by my company's software eng department, for me to use in a production environment, however some revisions of the JSON files have ...
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
235
views
Get object properties from a generic object in java
I have a method to get properties from a generic object in c# below. How can I get the same in java?
public string GetProperty<T>(T obj)
{
var s = string.Empty;
...
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
2
answers
339
views
How do I make the child object not inherit a method or property from the parent object?
I'm creating a child object using class, but I don't want it to inherit some properties and methods from the parent object.
I want to know if there is any way to do this.
my code:
class Player {
#...
2
votes
1
answer
69
views
Using methods to select an object's property and assign it a value creates an error
I am trying to write a method that based on some value, returns a property that I'd like to define in another method. However, I am having a strange 'Uncaught ReferenceError: Invalid left-hand side in ...
0
votes
0
answers
36
views
How does this function know to search for my input?
So probably a silly question. How does this function know to replace "obj" with whatever object I put in, and replace "checkProp" with whatever property I put in?
I'm pretty much ...
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,
"...