I am reading table values from UI row wise.I am reading the table by clicking each row and reading each value.

```
exports.getTableData = function(callback){
    var uiArray =[];
    var count;

    aLib.loadCheck(client);    
    //Clicks the first record of the table
    aLib.controlClick(client, obj.table.firstRecord);
    aLib.loadCheck(client);    
    // Gets the text of the total number of records on the top left of the table and uses it to drive the loop
    client.getText(obj.topContent.recordCount, function (err, rowNum){
       console.log(rowNum);
       count = rowNum.match(/\d/g).join("");
        console.log('No. of records on UI:', count);
          // Recursive function which clicks, reads the text in the selected row, and then clicks the next immediate row.
          // This way, the dynamic nature of the records appearing in the DOM, as one scrolls down is handled.
           function forLoop(i){
            client.getText(obj.table.selectedRow, function (err, text){

                var str = text.toString();//coverted UI text to string
                str = str.replace(/\n/g,",");//converted next line(\n/g) to comma
                str = str.replace(/\s/g, '');//removed blank space(\s/g)
                var text = str.split(',');//converted string to array again
                removed = text.splice(1,1);//  removed updated  by from UI
                removed = text.splice(6,1);// removed inserted on from UI
                removed = text.splice(7,2);// removed created by id from UI
               // console.log(text.length);
                uiArray.push.apply(uiArray, text);
               // console.log('UI array ki length',uiArray.length);
               console.log('i ki value :',i)
                if(i==count){

                   console.log('inside if..............'); 
                     console.log(uiArray); 
                     return callback(uiArray);
                }
                client.click(obj.table.nextRow);
                forLoop(i+1);
                });

            }
         forLoop(1);
    }); 

};

```

and my script calls this function getTableData.
 try { 

```
               aLib.getTableData(client, function (uiTable){
                console.log('suman00');
                console.log(uiTable);    
                 });  

             client.pause(12000);
        } catch (e) {
            expect(false).toBe(true);
            throw new Error('testcase case failed because of exception : ' + e);
        }
        client.call(done);
    },250000);

```

I am getting issue here at `return callback(uiArray);`

```
console.log(uiArray);  //this returns value successfully.however i am unable to return the array to my script.

```