Nikita2018-08-31 12:39:03
Nikita, 2018-08-31 12:39:03

2 variables are not equal to each other (Both with the same value) how is this possible?

Hello everyone, I have such a problem, there is a function, there is a check in it, there is 1 variable that stores the entered user data, and there is a second one that searches for the service from this data, and so there is a problem that now it just does not work ( everything is ok with other data) I have already watched the lines for a long time, and this way and that. 0 profit.
here is the code

CheckNewProduct: function () {
            if ($(child).val() == "") {
                return true;
            var isExists = false;
            var value = $(child).val().toUpperCase();  // тут у нас value = BLA BLA BLA
            for (var i = 0; i < keyArray.length; i++) {   // тут keyArray=66(внутри данные по 66 продуктам допустим, наш 66й)
                var arrValue = keyArray[i].toUpperCase();  // тут arrValue = BLA BLA BLA
                if (arrValue == value) {   // Получается false и ничего не сделать

Please help me and if possible explain what is the problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Sergey Kazakov, 2018-08-31

Perhaps "BLA BLA BLA" is really not equal, the characters are different, for example ,
try to check on simple values
, here is an example, maybe it will help

sl4m_mc, 2018-08-31

Perhaps you need to check for compliance and types of variables with ===

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question