In javascript you can't use statements in expressions. Because of this you are forced to use logic and ternary operators in an expression when you want to use if or switch etc.. Since I didn't want to use ternary operators everytime I do a condition check, I've written simple functions to do condition checks.Using them I write code like this: this.getEvent('aFrame').on(() => _if(this.isInTextEditor()).true(() => _if(this.getConfig('typeFrame')).true(() => _switch(this.state, {    resume: () => this.bufferStack.check(() => this.animation.nextFrame(this.bufferStack.pop()))})).false(() => _switch(this.state, {    resume: () => this.animation.nextFrame()}))));Better formatted to understand:this.getEvent('aFrame').on(() =>    _if(this.isInclined()).true(() =>        _if(this.getConfig('typeFrame')).true(() => _switch(this.state, {            resume: () => {                this.bufferStack.check(() => this.animation.nextFrame(this.bufferStack.pop()));            }        })).false(() => _switch(this.state, {            resume: () => {                this.animation.nextFrame();            }        }))    ));The _if and _switch functions are:const _switch = (a, obj) => {    return obj[a] && obj[a]();};const _if = val => {    return {        true(fn) {            val && fn();            return this;        },        false(fn) {            !val && fn();            return this;        }    };};Everything is working fine with this code. But I just want to know if there are any downsides using this instead of ternary or logical operators:this.getEvent('aFrame').on(() =>    this.isInclined()        && ((this.getConfig('typeFrame')            ? (this.state === 'resume'                && this.bufferStack.check(() => this.animation.nextFrame(this.bufferStack.pop())))            : (this.state === 'resume'                && this.animation.nextFrame()))        ));Or simply using statements:this.getEvent('aFrame').on(() => {    if (this.isInclined()) {        if (this.getConfig('typeFrame')) {            switch (this.state) {                case 'resume':                    this.bufferStack.check(() => this.animation.nextFrame(this.bufferStack.pop()));                    break;                default:                    break;            }        } else {            switch (this.state) {                case 'resume':                    this.animation.nextFrame();                    break;                default:                    break;            }        }    }});Note: This question was moved from Stack Exchange Code Review.
Using expressions instead of statements
javascript;if statement
The benefit of an if expression is its result can be assigned to a variable, like:var result = _if(...Or perhaps its result is directly used in an expression.  This isn't the case in your example.  All the calculation is done by side effect.  You are essentially ignoring the result of the if expressions, so they may as well be statements.I'm all for the benefits of an if expression, but if you don't actually use the result, there's no need for the extra visual noise it requires.Also, if this style of JavaScript appeals to you, you should know that there are several existing functional programming libraries like Ramda that can help you avoid reinventing the wheel, and give you better examples of idiomatic usage.