DEV Community

Discussion on: What do you think about the ternary operator?

Collapse
 
qm3ster profile image
Mihail Malo • Edited
// WHY NOT THIS?
startOfLine(enable = true) {
    this._prefixes = (enable && '^') || ''
    return this.add()
}

// OR EVEN THIS?
endOfLine(enable = true) {
    return(this._suffixes = (enable && '$') || '', this.add.bind(this))()
    //    ^ look mom, no space after `return`                          ^
    //                                                                 |
    //             note the artisanal external position of call parens |
}