Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey

All Questions

Tagged with
0 votes
7 answers
140 views

JavaScript can I directly access to a property inside a property in the object?

In this object, I want to print out an array in the form of [userName, skills]. I know that these objects don't have indexes. Is it possible to detect the skills property and only print out the value ...
bluebug's user avatar
-1 votes
3 answers
647 views

How check if there is no duplicate values for a list of properties in an object in javascript

const arr = \["key1", "key2", "key3"\]; example 1 : const obj = {key1 : "1", key2 : "2", key3 : "2", key4: "4", key5 : "5&...
bifi's user avatar
  • 19
0 votes
3 answers
2k views

JavaScript bracket notation on object returning undefined on existing key

Summary: Unable to access object key value using bracket notation as the existing key is returned as undefined. I have an array of users (constructed by parsing a CSV files and its columns): let users ...
Charlotte Prevost's user avatar
0 votes
1 answer
995 views

How do I access an object property/key in Java (Android) by string variable

EDIT: To clarify, I want to get the value of the property, not the name of the property. I know the name of the property but I need to access the property via a string containing the property name. I ...
Dan's user avatar
  • 11
0 votes
1 answer
54 views

Iterating through Objects of Objects Javascript?

I have this object structure that I want to iterate through to make a node of all the "properties." So I want to make nodes for the objects 1,2,5, and 8 but not for the arrays. I have this ...
hao's user avatar
  • 73
0 votes
3 answers
28 views

Need help inputting properties into object variable

I want to make it so in the input box, when it is entered, the values are assigned to properties in the object variable. For example: If for the weight you input 180, the value of 180 is assigned to ...
Kai's user avatar
  • 47
1 vote
1 answer
34 views

Can someone please explain in plain english what is going on in a particular part of my code for objects?

although it is a very simple code, I would like to get a full understanding of what is happening in my condition: let getFreqOn = function(string){ //set a variable for object let object = {...
Terry's user avatar
  • 31
1 vote
1 answer
496 views

Access object property with variable and fallback to default property if non-existing

I'm new to the switch statement in Javascript. The cool thing about it is that it combines multiple if statements with a default result if all if's failed. I'm a curious person and would like to know ...
Advena's user avatar
  • 2,143
2 votes
3 answers
319 views

Weird behaviour when using objects as keys in Javascript

Consider the following snippet: var a = {amount: 300} var b = {amount: 250} var c = {[a] : 'bla', [b]: 'blabla'}; console.log(c[a]); It prints: blabla But should it not print: bla What is going ...
Soggiorno's user avatar
  • 774
-1 votes
3 answers
2k views

Is there a way to use square brackets "[]" in JavaScript object arrays?

Is there a way to use square brackets "[]" in JavaScript object arrays? There is a square bracket in the key I am trying to make and it is causing an error to fire. For instance, I have an array of ...
Erik Boud's user avatar
0 votes
1 answer
119 views

How to reference an Object based on a Key Value?

I have an array of objects: [obj1, obj2, obj3] obj1 = {id:1,name:First} obj2 = {id:2,name:Second} ... But the object's array indexes are constantly changing. How else can I reference a specific ...
Joe Lee's user avatar
  • 31
3 votes
2 answers
129 views

JavaScript: Dynamically generated object key [duplicate]

const cars = [ { 'id': 'truck', 'defaultCategory': 'vehicle' } ] const output = [] Object.keys(cars).map((car) => { output.push({ foo: cars[car].defaultCategory }) }) ...
knitevision's user avatar
  • 3,093
0 votes
2 answers
40 views

I want to order items returned from an object based on the property key value and then assign a ranking to each item in the interface (1,2,3...etc)

Newb here with a basic question. Here is my object: {TestOne: 12, TestTwo: 6, TestThree: 4, TestFour: 2} I've looped through it using a for-in loop and grabbed the properties and displayed it in my ...
loady toad's user avatar
0 votes
1 answer
59 views

Using one function to update an object value used by another function using jquery?

I am writing a quiz app that references an object with values, everything is working well, even though this is beginner code. Specifically, I want the first question to be replaced by the second ...
user52's user avatar
  • 69
-1 votes
2 answers
2k views

Return JSON properties

I am trying to return my JSON object's properties. My JSON file object looks like: { Products: { 'Cars': { tableFields: [Object] }, 'Planes': { tableFields: [Object] } } } I am ...
Trung Tran's user avatar
  • 13.6k

15 30 50 per page