Skip to main content

All Questions

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
-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 = &...
TheRevenant95's user avatar
1 vote
4 answers
1k views

Shorthand Method to Create Property in Object only if Variable is defined

Looking for a shorthand method to assign properties to an object ONLY when the assigning variable is defined. Current Code: let count = {}, one = 1, two = 2, four = 4; if (one) count.one = one; if (...
Steve S's user avatar
  • 79
1 vote
0 answers
31 views

Hi - this may be a question that was asked before but how do we assign a variable's value as Property / Value of another new variable?

I am trying to match 2 clicks - one from Phrasal Verb to one from Meaning's and combine them as Objects into a new variable called userSelect. Making the Phrasal Verb clickable to become new ...
Daniel L's user avatar
1 vote
3 answers
40 views

How to include 2 different Variables as Property and Value for a third Variable in Javascript or jQuery

var A = $(this).attr("id") //result is a string var B = $(this).attr("id") //result is another string from a different id var C = { A: B //I want to use A as Property and B as Value }; when ...
Daniel L's user avatar
1 vote
0 answers
139 views

How to use variable as a part of the object property name in Javascript? [duplicate]

I'd like to use "param" as a part of the object property name in following code: In php I'd it would look like this: $paramvalue = object.$$param; Here is the code I'm using: function ...
Eki's user avatar
  • 95
1 vote
1 answer
2k views

How to store a JavaScript variable inside of an object as a property

I am trying to dynamically grab the width of an image in the DOM and then store/overwrite the existing property in a previously declared JavaScript object. I am able to get the width of an image on ...
Peter's user avatar
  • 624
-1 votes
2 answers
68 views

Use concatenation to write the property name

There is a way to write this? $request->inputModificaNome.$nomeModel.$i; where "inputModificaNome" is always the same and $nomeModel and $i are variables.
Bryan Del Bianco'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
2 votes
2 answers
2k views

How do I reference an object's property in a Powershell Active Directory cmdlet?

Related to this fantastic answer about how to properly construct a -Filter parameter argument, I'm working on a script that makes heavy use of the Active Directory cmdlets in PowerShell, and am having ...
HopelessN00b's user avatar
0 votes
0 answers
23 views

Convert Strings to Multidimensional Variable Names in Javascript [duplicate]

I have a a JavaScript object defined as follows function MyObject () { this.x = 10; this.foo = { x: 20 }; this.bar = { baz: { x: 30 } } } ...
Greeso's user avatar
  • 8,010
8 votes
1 answer
3k views

Javascript - Convert object properties to variables inside function scope [duplicate]

This is what i want to achieve: let scope = { property: "value" }; function fun() { //That's how I can get my variables: console.log(this.property); //And that's how I want to get them ...
Isaac Reason's user avatar
0 votes
2 answers
132 views

php variable object property

this maybe seems like duplicate, but I tried all answers and none of them helped me. I have a: class Api extends Controller { private $host; function __construct() { parent::...
Ph Abd's user avatar
  • 77
0 votes
0 answers
33 views

Variable stored Object Property name used to reference said Object Property name

In Powershell can one reference a Object's property through the contents of a variable? To allow changing of variable contents to change logic, instead of changing the logic directory. See the below ...
user66001's user avatar
  • 805
2 votes
1 answer
38 views

How to set an instance property with two numerical variables

I'm trying to figure out how to use the two variables arect and declin to define the target property inside the aladin instance. The target property needs the two numerical values separated by a ",". ...
hologhost's user avatar

15 30 50 per page