All Questions
Tagged with object properties
1,192
questions
2
votes
0
answers
317
views
Transform JavaScript object by clearing, adding and removing properties
Here are the instructions for what I am supposed to do:
Implement a function accepting 2 arguments: state and actions. The
function should change the state basing on the given actions
array.
state ...
0
votes
0
answers
62
views
Why does Object.defineProperty make a property invisible when logged?
I'm trying to understand why using Object.defineProperty makes a property not visible when the object is logged in the console.
For instance:
let foo = {};
Object.defineProperty(foo, "a", {
...
0
votes
0
answers
131
views
Convert a string chain of property accessor to give the actual value (JavaScript)
My question is quiet simple.
I have an object that looks like that:
const person = {
name: 'David',
locations: [
{
country: 'Belgium',
},
{
country: 'France',
...
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:
...
0
votes
1
answer
33
views
How can I change property value of an object after executing eventListener
So, I wanna change property used from 0 to 1 when it's used, but when I do
function x() {
const array = [{
name: x,
surname: y,
...
-2
votes
4
answers
77
views
javascript assign variable to key-values extracted from object
how can i do something like the following
const BigObject = {
"id":"value",
"img":"value",
"name":"value",
"otherData":"value&...
-1
votes
1
answer
24
views
How do i change the value of each property in an array with objects and return it?
Let's say i first have a list of objects with properties of r, g, b values that would look
something like this:
let color_pixels = [{r: 100, g: 20, b: 40}, {r: 80, g: 50, b: 30}];
let image = ...
1
vote
2
answers
2k
views
TypeScript: Add custom type to a single property in object
Let's say there is an object that looks like this:
const object = {
prop: "prop",
typedProp: "type-1",
};
I want the typedProp property to only accept the following values: &...
1
vote
1
answer
902
views
Remove object key but keep its properties
Let's say there is an object that looks like this:
const before = {
keyToBeRemoved: { // <-- remove the key
name1: "value 1", // <-- keep the property
name2: "value ...
0
votes
0
answers
57
views
C# Object properties comparison
I have a class which is used for objects comparison:
public static class ComparisonHelper
{
public static bool DeepCompare(this object obj, object another)
{
if (...
0
votes
1
answer
99
views
Cleanest way to set multiple object keys
Hi I was working on a text parser and I was wondering if there was a clean to rewrite the following code. Concerning the way that an object's properties are set.
//In the real case the ...
1
vote
1
answer
118
views
How to change the property of an object in a loop using a checkbox in vuex
I have a todosModule which contains the necessary state. The todos array contains the objects. When I output them through the loop, I need the completed property of a specific object in the loop to ...
0
votes
2
answers
124
views
How to find and check obects with all properties being empty in Matlab?
For example, I create a student with all properties being empty
classdef student < handle
properties
name
test
end
methods
function obj = student(name)
...
2
votes
1
answer
96
views
How to find objects with specific properties(another objects with specific properties) in Matlab?
For example, an object 'student' with a property 'test' , and 'test' is also an object with a property 'score'.
classdef student < handle
properties
name
test
end
...
1
vote
1
answer
41
views
Can a property of an object become other object's property, but still 'belongs to its owner'?
I don't know how to express 'property belongs to its owner' properly.
For example, I define classes 'student' and 'teacher'
classdef student < handle
properties
name
homework
...