I am using replace method to replace some text for example:-
let data = "My name is [[employeeName]]";
data.replace('[[employeeName]]', this.employee.employeeName);
Now my concern is the employee object which can be null, if it is null then above code will fail. So I want to put the condition some thing like this:
{this.employee ? this.employee.employeeName : ''}
How can I put a condition inside the replace() method?
Please assist me
employeeNameor replace it with empty string?replaceargument?!data.replace('[[employeeName]]', this.employee ? this.employee.employeeName : '');