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


Groups > comp.lang.javascript > #26543

Re: Can somebody give me an example how I can call this forEachIn function

From Martin Honnen <mahotrash@yahoo.de>
Newsgroups comp.lang.javascript
Subject Re: Can somebody give me an example how I can call this forEachIn function
Date 2015-01-11 15:57 +0100
Organization Liberty Development
Message-ID <m8u310$2bao$1@adenine.netfront.net> (permalink)
References <m8rcir$9u1$1@dont-email.me>

Show all headers | View raw


Tony Johansson wrote:
> Just specify some variables or object so I can uderstand hiw this
> forEachIn can be called
>
> function forEachIn(object, action)
>     {
>         for(var property in object)
>         {
>             if (object.hasOwnProperty(property))
>             {
>                 action(property, object[property]);
>             }
>         }
>     }

For instance,

var obj = { prop1: 'foo', prop2: 42 };

forEachIn(obj, function(propName, propValue) {
   console.log(propName + ' has value "' + propValue + '"');
});

will output

prop1 has value "foo"
prop2 has value "42"


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

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Can somebody give me an example how I  can call this forEachIn function "Tony Johansson" <johansson.andersson@telia.com> - 2015-01-10 15:22 +0100
  Re: Can somebody give me an example how I can call this forEachIn function Martin Honnen <mahotrash@yahoo.de> - 2015-01-11 15:57 +0100
    Re: Can somebody give me an example how I can call this forEachIn function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-11 17:43 +0100

csiph-web