"/>

How to write short handed IF else statement : Angular2 & typescript [duplicate]

This question already has an answer here:

I want to write a cleaner code , i have been doing some research but i find nothing relevant, For an example , how do we write

if (_finalConfigRight[0].icon == "") {
        this.icon3 = defaultConfig[0].icon;
    } else {
        this.icon3 = rightConfig[0].icon;
 }

in shorter and cleaner code . On the other hand, in case we need to use if else and withing the if else statement , we are using else if {} condition, is it a good practice that we use the short handed way as well ?

Thanks in advance:)

Read Full News
Submit your Tech Updates