Home how to use property of object in loop?
Reply: 0

how to use property of object in loop?

user698 Published in April 26, 2018, 5:23 pm

I want to have a loop with some properties of a class, not all of it's properties. I want to implement a function for properties of the class. But even I don't know how to set the length of loop with number of properties in class. For example this is my class:

class Address{
id: number,
street: string,
state: string,

and I want to make a loop with length of the object of this class and do something on each property of this object of Address class, something like this:

for (let i; i< /*length of address object*/; i++) {
if (/*each property of address */) {
// do sth

I'm using Angular 4. Thank you

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.339061 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO