DEV Community

VICTOR OMONDI
VICTOR OMONDI

Posted on

Ternary operator in Python vs Javascript

Python

result = [on_True] if (condition) else [on_False]
Enter fullscreen mode Exit fullscreen mode

Javascript

let result = (condition) ? [on_true] : [on_false]
Enter fullscreen mode Exit fullscreen mode

Top comments (0)