[Solved] How to refactor my conditional statement? [closed]

[ad_1]

A ternary that reproduces your if/else:

title = title == 'project' ? text + ': ' + this.projectTitle : this.projectTitle;

Though if you really want to shorten it:

title = (title == 'project' ? text + ': ' : '') + this.projectTitle;

References:

[ad_2]

solved How to refactor my conditional statement? [closed]