You will be strongly discouraged from working with the actual value of a Symbol (which can theoretically be different between different JS engines), so the name of the Symbol, like Symbol. In short, they're a new primitive data type which has an opaque unguessable value (technically a string value). The most common usage of computed property names will probably be for ES6 Symbols, which we will not be covering in detail in this book. But that's not really helpful when declaring objects using the object-literal syntax.ĮS6 adds computed property names, where you can specify an expression, surrounded by a pair, in the key-name position of an object-literal declaration: var prefix = "foo" The myObject property access syntax we just described is useful if you need to use a computed expression value as the key name, like myObject. MyObject"] // "baz" Computed Property Names Now, being on the earth, you only want to calculate forces for objects on this planet. This function takes in the three necessary parameters as arguments. If you don't know the formula, you can find it here. The literal syntax for an object looks like this: var myObj = Suppose you have a function that calculates the gravitational force acting on an object. Objects come in two forms: the declarative (literal) form, and the constructed form.
![you dont know js currying you dont know js currying](https://res.cloudinary.com/practicaldev/image/fetch/s--7AcgHgSE--/c_imagga_scale,f_auto,fl_progressive,h_500,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pmu7i1stb52kuheuaq0t.png)
![you dont know js currying you dont know js currying](https://res.cloudinary.com/practicaldev/image/fetch/s--dsbP0bf4--/c_imagga_scale,f_auto,fl_progressive,h_1080,q_auto,w_1080/https://dev-to-uploads.s3.amazonaws.com/i/viplwlivvz3xxahdycac.png)
But what exactly are objects, and why do we need to point to them? We will explore objects in detail in this chapter. In Chapters 1 and 2, we explained how the this binding points to various objects depending on the call-site of the function invocation. You Don't Know JS Yet: Objects & Classes - 2nd Edition Chapter 3: Objects NOTE:Įverything below here is previous text from 1st edition, and is only here for reference while 2nd edition work is underway.