What to do in this case - cannot read property split of undefined?

302    Asked by elonji_3393 in Salesforce , Asked on Mar 2, 2023

 I have the following LWC, when I try to add on my lightning record page I get some error like, cannot read property of split.

js:
import { LightningElement, api, track } from 'lwc';
    export default class CustomRecordDetail extends LightningElement {
     @track fieldArray;
        connectedCallback()
         {
            if(this.fields !== null && typeof this.fields !== undefined && this.fields !== '')
            {
                this.fieldArray = this.fields.split(",");
            }
    }
    }
html :