Skip to main content

All Questions

Tagged with
0 votes
2 answers
32 views

Object property has different many string values

I have objects, that has different properties, one of them is programingLanguage. So, with the function, I want to check if the object property - programmingLanguage has a value of "Java". ...
Zuka Kharati'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
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', ...
Simon's user avatar
  • 259
0 votes
2 answers
2k views

Typescript - How to return an object with a property removed where the property is given as a string

How in Typescript can I write a function where I can pass in any object and a string property to be removed and get back a new object with all the original properties except for the one that should be ...
Paul's user avatar
  • 161
1 vote
4 answers
47 views

Checking if any variable in object have null/undefined/emptyString('')

I want to check if there is any empty field or not before submitting form. But the problem is I have variable number of fields (value1,value2...) So i can not use simple if statement. So is there any ...
Rajan Lagah's user avatar
  • 2,508
0 votes
3 answers
5k views

In Javascript, how to convert a string to a property name? [duplicate]

I have a global object with various properties whose values are strings. When a user types a string into an HTML input, I'm using javascript to assign that string to a variable. I need to convert that ...
Truth's user avatar
  • 496
3 votes
5 answers
72 views

how to convert data formats in javascript

I am trying to get a paragraph and turn it into words and also realize the frequency of each. var pattern = /\w+/g, string = "mahan mahan mahan yes yes no", matchedWords = string.match(...
Mahanmeh's user avatar
3 votes
3 answers
597 views

get all fields in object that have given word and transform all values of these fields

I have an object. like this, for example { startDate: 2141242141, adress: '', endDate: 2141242141, billings: { startBillingDate: 2142421421421, ...
Andrii Blinov's user avatar
0 votes
1 answer
29 views

How can i output a string next to the result of an object

i have an object var a = { type: '{type}' } i have written code to get the 'type' property of an object and display it. the output is correct but now i want to add a string before printing the ...
user avatar
1 vote
1 answer
74 views

Get Property of Local Object using String

I want to get the value of a property of a local object variable by using it's "fully qualified" variable name. function foo() { var obj = { prop: "val" } var valueStr = "obj....
4castle's user avatar
  • 33.3k
0 votes
4 answers
491 views

Get object with string identifier

I need help with getting property of object with String in JS. I have object elements = { element : { date: { day: 'Monday' } } } and i have JS ...
user2899587's user avatar
-2 votes
1 answer
126 views

How to convert a javascript string to reference an object property?

I have a custom object with a bunch of array properties. function Location (name, displayName){ this.name = name, this.displayName = displayName, Location.objects.push(this); ...
JPillow's user avatar
0 votes
1 answer
413 views

PHP setting nested object property with string literal

$person is an object which has the property 'name' which has the property 'first'. Can I access the property 'first' from top level $person with a single string literal? I've tried, $prop='name->...
user2782001's user avatar
  • 3,428
0 votes
2 answers
36 views

How to use a var to look up and change a Object Property

I'm looking for a way to use a string as a lookup in an Object. Here is my code: $.extend(true, myOptions,{ series: {lines: {show: true} } } ); The lines property could also be one of these: bars ...
Koen H's user avatar
  • 111
109 votes
18 answers
163k views

Get object property name as a string

Is it possible to get the object property name as a string person = {}; person.first_name = 'Jack'; person.last_name = 'Trades'; person.address = {}; person.address.street = 'Factory 1'; person....
CLiFoS's user avatar
  • 1,193

15 30 50 per page