ReferenceError:key is not defined Salesforce Lightning issue

ReferenceError:key is not defined Salesforce Lightning issue

To fix “ReferenceError:key is not defined” Salesforce Lightning issue, declare the variable inside the for loop. Check the below example.


Sample Code:

                for ( var key in conts ) {
                    custs.push({value:conts[key], key:key});
                }

Cheers!!!

Leave a Reply