Sunday 11 June 2017

string not found from object.keys arr result

i have a problem with my code and i not find my error:

this is my code:

let objectKeysArr = Object.keys(valJson);
        console.log(objectKeysArr+' , '+objectKeysArr.length);

        for(let i = 0; i < objectKeysArr.length; i++)
            console.log(objectKeysArr[i]);


        let parWithLocObj = {};

        try{
            for(let i = 0; i < objectKeysArr.length; i++){
                try{
                    if(objectKeysArr[i]){
                        objectKeysArr[i] = objectKeysArr[i].toString();
                        console.log('continue');
                        User.getLocationByParID(objectKeysArr[i]).then((partOfParticipant)=>{});

my error is:

TypeError: Cannot read property '0' of undefined

this is very strange because in my server's logs this arr is defined:

objectKeysArr = [-KkfjoHqek5p_Jik1Baz]

thanks for anyone that can help me.



via noam aghai

No comments:

Post a Comment