Is there a better way to write my Javascript while loop RRS feed

  • Question

  • I have the loop below in an array result.entities, I want it to loop through until there are no more records. I don't know the total number of records however. The code below works but I get an error at the end.

                    contact =  result.entities[0];
                        if (contactC != null)
                         while (contactC != null)
                          	contactC =  result.entities[i].name;

    • Edited by Sebd.DD Thursday, June 20, 2013 12:10 PM
    Thursday, June 20, 2013 12:04 PM

All replies

  • Hi Marcus,

    Try it out.

    				for( var i=0 ;i < result.entities.length ; i++)
    					if(result.entities[i] !=null)

    Hope it helps,


    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Mohammad Yusuf Ansari http://microxrm.blogspot.in

    Thursday, June 20, 2013 1:03 PM