function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Saurabh PriyadarshanSaurabh Priyadarshan 

LWC: Cannot remove undefined as a value

I have a lwc which displays few account fields. I am using wire service to display account field values. But when there is no value, it shows undefined as a value in LWC. I want to show it as a blank. 
I tried several ways but couldn't come up with a solution. Please help.
Here is the javascript code:

export default class AccountTab extends LightningElement {
    @api recordId;
    @api accountList;
    @wire(getAccounts, {recordId:'$recordId'})
    wiredAccounts({data,error}){
        if(data){        
            this.accountList = data;
            console.log('current record id : '+this.recordId);
            this.error=undefined;
            
           
        }else if(error){
            this.error=error;
            this.accountList=undefined;
            
        }
    }
}
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Saurabh
Please try this  : 

export default class AccountTab extends LightningElement {
    @api recordId;
    @api accountList = [];
    @wire(getAccounts, {recordId:'$recordId'})
    wiredAccounts({data,error}){
        if(data){        
            this.accountList = data;
            console.log('current record id : '+this.recordId);
            this.error=undefined;
            
           
        }else if(error){
            this.error=error;
            this.accountList=[];
            
        }
    }
}
Saurabh PriyadarshanSaurabh Priyadarshan
@Syed
Tried this but still getting undefined.
Syed Insha Jawaid 2Syed Insha Jawaid 2
@Saurabh

Is there any value in data variable?
Also please attach screenshot and HTML.