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)

Join 900k+ Developers on DEV

You'll see more of the content that brought you here.