Answer the question
In order to leave comments, you need to log in
How to check for the existence of a variable in CoffeeScript?
Good morning!
I recently discovered the ||=
and operators ?=
.
Questions immediately arose:
1) What are their differences, besides the fact that ||= is a string operation, and ?= is executed through if
2) Can the entry be replaced value = value ? {id: 1}
with value ||= {id: 1}
or bettervalue ?= {id: 1}
Answer the question
In order to leave comments, you need to log in
In fact, they are very different checks.
will turn into
value || (value = {
id: 1
});
if (value == null) {
value = {
id: 1
};
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question