Skip to main content

All 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, '...
Vijay G Rama's user avatar
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 ...
Kwok's user avatar
  • 13
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: "...
Ralph David Abernathy's user avatar
0 votes
0 answers
26 views

Why I need to access multiple nested properties of an object? [duplicate]

Please don't close my question. Earlier it was closed with a wrong solution, Assignment with double ampersand "&&". Please help me understand the Redux code. Why can't I use directly ...
Zonaed Hasan's user avatar
-1 votes
2 answers
44 views

Adding objects as properties of a master object with Javascript

I have a master object, for example: MasterObj = { property1: ... method1: ... } and multiple other objects: obj1 = { properties and methods... }, obj2 = { properties and methods... } I need to make ...
user3952846's user avatar
0 votes
1 answer
43 views

Adding values from a JavaScript object as classes on an element

In JavaScript, how would I take the values of an object and add each one as a separate class on an element in the DOM? For instance, let's say I have this object: const METADATA = { foo: 'test1', ...
user avatar
1 vote
2 answers
89 views

Is there a Javascript/Lodash function to check if an object is missing ANY properties?

I want to check a javascript object to see if any of it's properties are missing without checking each property individually. I can use "hasownproperty" or do if/else statements to check if ...
Laura Drill's user avatar
0 votes
0 answers
25 views

How can I access an object property inside the object while inside a function in the property without a getter?(javascript)

I have this code where I want all my code to be inside one main object without exeptions: var inputs = []; var Ivh = { addInput: (input, display, message, regex) => { inputs.push([input, ...
Koby K's user avatar
  • 41
2 votes
3 answers
59 views

Neater way to create an object

I am creating an object with values from an api response. Is there a neater way to do this? My code: const variables = { name: result.data.data.table.name, org: the_org, val1: result.data....
nb_nb_nb's user avatar
  • 1,347
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? ...
Zeke Cachi's user avatar
3 votes
2 answers
577 views

Is there a way of accessing the properties of an object in java by using a string to represent the property's name, just like in JavaScript?

In JavaScript you can access a property of an object in two ways: object.property object["property"] In Java, I am only aware of the first way. Is there a way to access a Java object's ...
Dark Rebellion's user avatar
0 votes
1 answer
48 views

While using the Object.defineProperties in JavaScript I am getting as ' undefined' on newly defined property .How to fix it..?

const object1 = { firstName : 'Shashidhar', lastName : 'B M ', rollNo : 5678, rank : 23456 } Object.defineProperties(object1,{ property1 : { results : 'selected' } }); ...
SBM's user avatar
  • 17
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 ...
Martim Silva's user avatar
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 ...
rmoreltandem's user avatar
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: "...
claramarsango's user avatar

15 30 50 per page
1
2 3 4 5
47