U
U
uRoot2020-04-27 10:50:27
JavaScript
uRoot, 2020-04-27 10:50:27

What is the difference between short notation if with brackets and without?

What is different, for example:

save ? save.addEventListener("click", () => ShowSpinButton('edit_labels')) : null
From:
(save) ? save.addEventListener("click", () => ShowSpinButton('edit_labels')) : null

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Klimenko, 2020-04-27
@uroot

Nothing.
Parentheses are needed to group and change the priority of operations. In this case, inside the brackets is a degenerate expression from one variable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question