JSFiddle - React, Tailwind, and code Playground

by doug65536

JavaScript

function foo() {
    console.log('foo');
    return 9;
}

function bar() {
    console.log('bar called');
}

function baz() {
    console.log('baz called');
}

function ambiguous(p) {
    foo()
    -p < 10 ? bar() : baz()
}

function correct(p) {
    foo();
    -p < 10 ? bar() : baz();
}

ambiguous(-9);
correct(-9);