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
250
votes
10 answers

What is the difference between JSON and Object Literal Notation?

Can someone tell me what is the main difference between a JavaScript object defined by using Object Literal Notation and JSON object? According to a JavaScript book it says this is an object defined by using Object Notation: var anObject = { …
pencilCake
  • 51,323
  • 85
  • 226
  • 363
17
votes
1 answer

Eclipse Javascript Editor 2012 with full Outliner support

The reason for using an IDE is the comprehensive facilities it provides. Therefore, I assume there is a Javascript editor for Eclipse that provides basic outliner-based IDE facilities such as: Outliner with Object Literal support (which apparently…
Redsandro
  • 11,060
  • 13
  • 76
  • 106
3
votes
1 answer

Why does object notation in Scala apparently eliminate the right side associativity of methods ending in ':'?

I am currently getting into Scala and am wondering about the difference it makes to use object notation when calling methods ending with ':'. As a method name ending in ':' would normally produce right-side associativity, this seems to change when…
J.Ober
  • 199
  • 2
  • 11
2
votes
1 answer

Is there a name for Python literals? The way JavaScript literals are called JSON?

I have a program that can output results either as JSON or Python data structure literals. I am wondering how to succinctly name the latter option.
user7610
  • 25,267
  • 15
  • 124
  • 150
2
votes
2 answers

Check String for Object/Dot Notation

I have a function that takes a string as an argument, my problem is that the string can be a sentence such as: "My name is John Doe. I need a car." or it can be a dot notation: "this.is.dot.notation". I don't know much about regex (if that's what I…
iwatakeshi
  • 697
  • 3
  • 17
  • 31
1
vote
3 answers

How To Set a Property's Property While Creating the Object

I have an object and one of the properties is an array. I want to set a new property on that array (customProp = 0). However, I want to do so inside myObject's declaration. myObject = { someString: "text", someArray: ["one","two"], /* What…
Gary
  • 13,303
  • 18
  • 49
  • 71
1
vote
2 answers

How is this Python design pattern called?

In the ffmpeg-python docs, they used following design pattern for their examples: ( ffmpeg .input('dummy.mp4') .filter('fps', fps=25, round='up') .output('dummy2.mp4') .run() ) How is this design pattern called, where can I find…
TheEagle
  • 5,808
  • 3
  • 11
  • 39
1
vote
3 answers

How do I increment and decrement values in an object using JavaScript Classes?

I am trying to do a simple Backpack class to review objects with vanilla javascript. While doing so, I've run into a block because I am unable to create a proper AddItem method or get my decrementItem method to work either. My code is below: class…
drome845
  • 139
  • 1
  • 1
  • 8
1
vote
1 answer

How to convert a Java object to a Jackson ObjectNode?

I have a Java object class, say, Student. How to convert it to an ObjectNode? It can be a nested object (multi-level nesting). I am trying following code to convert the object to ObjectNode, but it is first converting the object to a String and then…
Richa Gupta
  • 143
  • 3
  • 10
1
vote
3 answers

What does this square bracket suffix at the end of the object definition in JavaScript mean?

JavaScript code I was browsing someone's code on GitHub and came across this and have no idea what this means. I would have googled but I am new to JavaScript and have no idea how to google it. Any information would be appreciated! var charStr =…
themadking
  • 67
  • 1
  • 7
1
vote
4 answers

How to access javaScript object property NAME not VALUE

I have a an object me = { name: "Mo", age: 28, } And I want to see if this object has the property "height" for example. (which it doesn't) How can i do this? So for example if it has the property "height" I can give it a value of…
zzgooloo
  • 75
  • 3
  • 9
1
vote
3 answers

Is there a name for a language feature that allows assignment/creation?

This is a bit hard for me to articulate, but in PHP you can say something like: $myArray['someindex'] = "my string"; and if there is no index named that, it will create/assign the value, and if there IS an index, it will overwrite the existing…
Alex Mcp
  • 19,037
  • 12
  • 60
  • 93
1
vote
1 answer

Split array into pairs and pack into object

I have a an array with CSS text declarations like this: ['display: none ', 'opacity: 0.1', ' color: #ff0000'] I want to split these into object key/value notation so it ends up like this: { display: 'none', opacity: 0.1, color:…
dan-lee
  • 14,365
  • 5
  • 52
  • 77
0
votes
0 answers

updating object property updates all other same properties in that Object

This is confusing me to no end. I am trying to update an objects property dynamically based on vars provided by another function however, when I update the property it updates all the same nested properties of the parent object. export type…
Haq.H
  • 863
  • 7
  • 20
  • 47
0
votes
1 answer

JavaScript Object w/Async + forEach Loop - problems with value assignment

My goal here is to create an object, 'tallys,' that has a key for each user in a game, and the value assigned to those user keys is an array representing weekly dollar values won in a game. To begin, I assign each user in the game an array of length…
1
2