Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28538 > unrolled thread

How to solve this ?

Started byAjinkya Joshi <ajinkya.joshi.d@gmail.com>
First post2015-08-19 00:19 -0700
Last post2015-08-19 19:26 +0200
Articles 4 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  How to solve this ? Ajinkya Joshi <ajinkya.joshi.d@gmail.com> - 2015-08-19 00:19 -0700
    Re: How to solve this ? Martin Honnen <mahotrash@yahoo.de> - 2015-08-19 11:29 +0200
    Re: How to solve this ? Denis McMahon <denismfmcmahon@gmail.com> - 2015-08-19 17:02 +0000
      Re: How to solve this ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-08-19 19:26 +0200

#28538 — How to solve this ?

FromAjinkya Joshi <ajinkya.joshi.d@gmail.com>
Date2015-08-19 00:19 -0700
SubjectHow to solve this ?
Message-ID<ed7fa790-443f-4e27-8bca-0d9f194dc36a@googlegroups.com>
Write a javascript function, findPath(obj, str), that takes a javascript object and a string parameter and iterates through the object and returns the path to the key that contains the string as a value (using '.' as a separator). For example:

var obj = { bat: bee, bird: plane, bee : { foo : bar, test : { text: needle } } };

var path = findPath (obj, 'needle');

Would yield:

path = "bee.test.text"

[toc] | [next] | [standalone]


#28539

FromMartin Honnen <mahotrash@yahoo.de>
Date2015-08-19 11:29 +0200
Message-ID<mr1i9h$22i$1@adenine.netfront.net>
In reply to#28538
Ajinkya Joshi wrote:
> Write a javascript function, findPath(obj, str), that takes a javascript object and a string parameter and iterates through the object and returns the path to the key that contains the string as a value (using '.' as a separator). For example:
>
> var obj = { bat: bee, bird: plane, bee : { foo : bar, test : { text: needle } } };

Should needle be a string literal 'needle'? Or is that another variable 
defined elsewhere?




--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#28544

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-08-19 17:02 +0000
Message-ID<mr2cr9$j0a$2@dont-email.me>
In reply to#28538
On Wed, 19 Aug 2015 00:19:22 -0700, Ajinkya Joshi wrote:

> Write a javascript function ....

coursework yourself do!

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#28545

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-08-19 19:26 +0200
Message-ID<XnsA4FBC5D157576eejj99@194.109.6.166>
In reply to#28544
Denis McMahon <denismfmcmahon@gmail.com> wrote on 19 Aug 2015 in 
comp.lang.javascript:

> On Wed, 19 Aug 2015 00:19:22 -0700, Ajinkya Joshi wrote:
> 
>> Write a javascript function ....
> 
> coursework yourself do!

courseoff.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web