Answer the question
In order to leave comments, you need to log in
Why does some see an object that doesn't exist?
There is a button that checks the array for the presence of an object, if there is no object, this object is added.
At the first check (when the array is empty), the required object is added to the array
. But for some reason, further, when checking, it turns out that there is an object in the array that is not there.
Answer the question
In order to leave comments, you need to log in
What logic do you think should be put into the variable i
?
Judging by the code, the variable i
will take on a value true
if at least one element elem
in the array cart
will not be equal scope.items
Accordingly, ALMOST ANY newly added element scope.items
to the array cart
will not be equal to AT LEAST ONE that is already in the array => you will get the output i = true
when i == = true code block on lines 58 - 61 will not be executed
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question