Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #25023 > unrolled thread
| Started by | bit-naughty@hotmail.com |
|---|---|
| First post | 2014-06-25 10:33 -0700 |
| Last post | 2014-06-27 09:46 +0000 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.javascript
What does x.y.z mean? bit-naughty@hotmail.com - 2014-06-25 10:33 -0700
Re: What does x.y.z mean? Gregor Kofler <usenet@gregorkofler.com> - 2014-06-25 21:41 +0200
Re: What does x.y.z mean? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-26 11:09 +0200
Re: What does x.y.z mean? bit-naughty@hotmail.com - 2014-06-26 06:25 -0700
Re: What does x.y.z mean? John Harris <niam@jghnorth.org.uk.invalid> - 2014-06-26 14:47 +0100
Re: What does x.y.z mean? John Harris <niam@jghnorth.org.uk.invalid> - 2014-06-27 09:52 +0100
Re: What does x.y.z mean? Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-27 09:46 +0000
| From | bit-naughty@hotmail.com |
|---|---|
| Date | 2014-06-25 10:33 -0700 |
| Subject | What does x.y.z mean? |
| Message-ID | <a93c4421-8f80-4f76-ab42-a034af382a20@googlegroups.com> |
I always had this figured out: x is an object, of which y is a method that returns an object itself, and z is a property or method of *that* object - am I right in this? Also, what happens in the case of an object literal? Is y an object inside x, and z an object inside y? Or am I completely mistaken?
[toc] | [next] | [standalone]
| From | Gregor Kofler <usenet@gregorkofler.com> |
|---|---|
| Date | 2014-06-25 21:41 +0200 |
| Message-ID | <lof8kj$ork$1@dont-email.me> |
| In reply to | #25023 |
Am 2014-06-25 19:33, bit-naughty@hotmail.com meinte: > I always had this figured out: Copying the question into the message body is smart? > x is an object, of which y is a method that returns an object itself, and z is a property or method of *that* object - am I right in this? No. This would be x.y().z > > > Also, what happens in the case of an object literal? What should "happen"? > Is y an object inside x, and z an object inside y? Or am I completely mistaken? y and z are properties, which values in turn can be objects. In the above example y is assumed to hold an object. Gregor
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-06-26 11:09 +0200 |
| Message-ID | <5429521.hve5E93COS@PointedEars.de> |
| In reply to | #25025 |
Gregor Kofler wrote: > Am 2014-06-25 19:33, bit-naughty@hotmail.com meinte: >> [x.y.z] >> Is y an object inside x, and z an object inside y? Or am I completely >> mistaken? > > y and z are properties, which values in turn can be objects. In the > above example y is assumed to hold an object. The values are *references to* objects instead. You are probably aware of that; however, it is important to emphasize because it means that *different* properties and variables can refer to the *same* object, and that objects do not *contain* other objects in these languages. IOW, “objects have identity, not name”. Why are you reading and replying to postings from trollishly anonymous Google Groupers? -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not Cc: me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | bit-naughty@hotmail.com |
|---|---|
| Date | 2014-06-26 06:25 -0700 |
| Message-ID | <60580b8d-8eb2-48cd-abe7-1fab43493571@googlegroups.com> |
| In reply to | #25025 |
On Thursday, June 26, 2014 1:11:07 AM UTC+5:30, Gregor Kofler wrote: > y and z are properties, which values in turn can be objects. In the > > above example y is assumed to hold an object. > Right, so what does "y.z" mean then? And that brings me back to my original question - what is x.y.z?
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2014-06-26 14:47 +0100 |
| Message-ID | <su8oq913mss8eimrsnf5t3ha2vkm0tlqk9@4ax.com> |
| In reply to | #25042 |
On Thu, 26 Jun 2014 06:25:50 -0700 (PDT), bit-naughty@hotmail.com wrote: >On Thursday, June 26, 2014 1:11:07 AM UTC+5:30, Gregor Kofler wrote: >> y and z are properties, which values in turn can be objects. In the >> >> above example y is assumed to hold an object. >> > >Right, so what does "y.z" mean then? > >And that brings me back to my original question - what is x.y.z? x.y.z means exactly the same as x["y"]["z"] by definition. John
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2014-06-27 09:52 +0100 |
| Message-ID | <t2cqq9lirisjr70l1isouogagdosar68js@4ax.com> |
| In reply to | #25044 |
On Thu, 26 Jun 2014 14:47:04 +0100, John Harris <niam@jghnorth.org.uk.invalid> wrote: >On Thu, 26 Jun 2014 06:25:50 -0700 (PDT), bit-naughty@hotmail.com >wrote: > >>On Thursday, June 26, 2014 1:11:07 AM UTC+5:30, Gregor Kofler wrote: >>> y and z are properties, which values in turn can be objects. In the >>> >>> above example y is assumed to hold an object. >>> >> >>Right, so what does "y.z" mean then? >> >>And that brings me back to my original question - what is x.y.z? > > x.y.z >means exactly the same as > x["y"]["z"] >by definition. If that doesn't help, then work it out this way : var a = x.y; var b = a.z; The second line will go BANG! if a is not [aka is not a reference to] an object. John
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-06-27 09:46 +0000 |
| Message-ID | <lojei7$i56$1@dont-email.me> |
| In reply to | #25023 |
On Wed, 25 Jun 2014 10:33:09 -0700, bit-naughty wrote:
> I always had this figured out:
>
> x is an object, of which y is a method that returns an object itself,
> and z is a property or method of *that* object - am I right in this?
>
> Also, what happens in the case of an object literal? Is y an object
> inside x, and z an object inside y? Or am I completely mistaken?
Stuff like this is so difficult to test for yourself isn't it.
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>x.y.z</title>
<script type="application/javascript">
function gebi(x) { return document.getElementById(x); }
var x = JSON.parse('{"y":{"z":"zed"}}');
function stuff() {
gebi("tofx").value = typeof( x );
gebi("tofxy").value = typeof( x.y );
gebi("tofxyz").value = typeof( x.y.z );
gebi("strx").value = x.toString();
gebi("strxy").value = x.y.toString();
gebi("strxyz").value = x.y.z.toString();
}
</script>
</head>
<body onload="stuff();">
<pre>
var x = JSON.parse('{"y":{"z":"value"}}');
</pre>
<p>
typeof x = <input id="tofx"><br>
typeof x.y = <input id="tofxy"><br>
typeof x.y.z = <input id="tofxyz"><br>
x.toString() = <input id="strx"><br>
x.y.toString() = <input id="strxy"><br>
x.y.z.toString() = <input id="strxyz"><br>
</p>
</body>
</html>
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web