Questions tagged [object-notation]

Use this tag for questions and answers regarding how to refer to objects and what certain notation for object mean

26 questions
0
votes
1 answer

Using magic constants to access object properties

I am about to load a language object as a property from controller object like this: $this->lang = new Languages(en) Inside the methods of my controller object i am currently accessing the specific translation like this: function =…
user11694442
0
votes
0 answers

How pass array name as parameter to reduce (add) function?

I want to be able to pass an array name to a function that sums all the values of an array. However, I can't get this working with bracket notation the way that I would with an object. UPDATE: Based on the comments below, I now realize that I can…
forestkelley
  • 341
  • 3
  • 14
0
votes
1 answer

JavaScript Object notation - using methods inside the same object?

i experimenting with node.js and i have a set of methods that are being exported using module.exports however some of the methods are meant to be reusable with the same object but i am not sure how to go about this. In PHP i would simply reference…
Frederick M. Rogers
  • 841
  • 4
  • 14
  • 37
0
votes
1 answer

How to refer to data in a JSON Object

I used JavaScript to request information from an API (VexDB to be exact). The information is in this format: [ { "sku": "RE-VRC-17-4815", "key": "RE-VRC-17-4815", "program": "VRC", "name": "MCC VRC Skills…
0
votes
1 answer

JS - Call function by name (in object notation)

I want to clean up some old code and optimize it, which often uses the same code. (with only different names of functions to call) I make a easier example and no, I don't write on a game. But this example looks more comprehensible to explaination of…
Sascha
  • 615
  • 1
  • 9
  • 20
0
votes
1 answer

Javascript Object Notation Pproblem

I have this fiddle http://jsbin.com/EvIYomiF/4/ and just to noticed in case that its matter the javascript is in two files. Well.. as you can see in the demo, the dom scope is being overwritten somehow and I want to understand why. I mean, the…
raulricardo21
  • 2,499
  • 4
  • 20
  • 27
0
votes
1 answer

How to use dynamic key name in object during object construction?

I want to use a dynamic key name during the creation of the object. var myKey = 'text'; var myObj = { [myKey]: 'Hello' // not working }; alert(myObj.text); I know you can do it on the next line after the object is created myObj[key] =…
0
votes
0 answers

Passing onchange event in object notation

I have a simple code, which goes with a more complex code though I will only be showing the snippet in the object notation. var test = { add: { select: function(options){ console.log(options.id); …
EasyBB
  • 6,176
  • 9
  • 47
  • 77
-1
votes
2 answers

Trouble with accessing Object property in vue

I am trying to access an Object property in vue component computed property but I am getting an error saying the property is undefined. I have setup a prototype here. When I try to use playerEntry.stats.RecYards["#text"] > "0" Vue complains [Vue…
Alan
  • 1,067
  • 1
  • 23
  • 37
-1
votes
1 answer

How to access an Array containing hash-like objects

I received an array from an API that appears to contain, for lack of a better phrase, object-style notation. Since it is an array, I cannot obviously access it by a key or value. I don't see a method in this particular object type that allows me…
Kurt W
  • 321
  • 2
  • 15
-1
votes
1 answer

how can i insert a variable string in a object notation (JSON)?

Take this JSON Object as an example: "pages": { "start": { .... }, "page1": { .... }, "page2": { .... }, .... } Now via the jQuery ajax function I load the above JSON object and save it's result…
TimG
  • 985
  • 3
  • 14
  • 24
1
2