Меню

Cannot read property tolowercase of undefined ошибка

I’m getting this error and it is originating from jquery framework.
When i try to load a select list on document ready i get this error.
I can’t seem to find why i’m getting this error.

It works for the change event, but i’m getting the error when trying to execute the function manually.

Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined -> jquery-2.1.1.js:7300

Here is the code

$(document).ready(function() {
    $("#CourseSelect").change(loadTeachers);
    loadTeachers();
});

function loadTeachers() {
    $.ajax({ 
        type: 'GET', 
        url: '/Manage/getTeachers/' + $(this).val(), 
        dataType: 'json', 
        cache: false,
        success:function(data) { 
            $('#TeacherSelect').get(0).options.length = 0;    
            $.each(data, function(i, teacher) {
                var option = $('<option />');
                option.val(teacher.employeeId);
                option.text(teacher.name);
                $('#TeacherSelect').append(option);
            });
        },         
        error: function() { 
            alert("Error while getting results"); 
        }
    });
}

Rory McCrossan's user avatar

asked May 18, 2014 at 14:28

Ronald's user avatar

0

When you call loadTeachers() on DOMReady the context of this will not be the #CourseSelect element.

You can fix this by triggering a change() event on the #CourseSelect element on load of the DOM:

$("#CourseSelect").change(loadTeachers).change(); // or .trigger('change');

Alternatively can use $.proxy to change the context the function runs under:

$("#CourseSelect").change(loadTeachers);
$.proxy(loadTeachers, $('#CourseSelect'))();

Or the vanilla JS equivalent of the above, bind():

$("#CourseSelect").change(loadTeachers);
loadTeachers.bind($('#CourseSelect'));

answered May 18, 2014 at 14:34

Rory McCrossan's user avatar

Rory McCrossanRory McCrossan

329k38 gold badges302 silver badges333 bronze badges

0

I had the same problem, I was trying to listen the change on some select and actually the problem was I was using the event instead of the event.target which is the select object.

INCORRECT :

$(document).on('change', $("select"), function(el) {
    console.log($(el).val());
});

CORRECT :

$(document).on('change', $("select"), function(el) {
    console.log($(el.target).val());
});

answered Aug 2, 2014 at 14:32

lenybernard's user avatar

lenybernardlenybernard

2,35921 silver badges22 bronze badges

2

This Works For me !!!

Call a Function without Parameter

$("#CourseSelect").change(function(e1) {
   loadTeachers();
});

Call a Function with Parameter

$("#CourseSelect").change(function(e1) {
    loadTeachers($(e1.target).val());
});

answered Feb 20, 2015 at 12:27

Aravinthan K's user avatar

Aravinthan KAravinthan K

1,6952 gold badges18 silver badges22 bronze badges

It causes the error when you access $(this).val() when it called by change event this points to the invoker i.e. CourseSelect so it is working and and will get the value of CourseSelect. but when you manually call it this points to document. so either you will have to pass the CourseSelect object or access directly like $("#CourseSelect").val() instead of $(this).val().

answered May 18, 2014 at 14:34

Rashmin Javiya's user avatar

Rashmin JaviyaRashmin Javiya

5,1053 gold badges27 silver badges48 bronze badges

It fails «when trying to execute the function manually» because you have a different ‘this’. This will refer not to the thing you have in mind when invoking the method manually, but something else, probably the window object, or whatever context object you have when invoking manually.

answered May 18, 2014 at 14:32

Lzh's user avatar

LzhLzh

3,5761 gold badge22 silver badges36 bronze badges

your $(this).val() has no scope in your ajax call, because its not in change event function scope

May be you implemented that ajax call in your change event itself first, in that case it works fine.
but when u created a function and calling that funciton in change event, scope for $(this).val() is not valid.

simply get the value using id selector instead of

$(#CourseSelect).val()

whole code should be like this:

 $(document).ready(function () 
{
    $("#CourseSelect").change(loadTeachers);
    loadTeachers();
});

function loadTeachers()
{
    $.ajax({ type:'GET', url:'/Manage/getTeachers/' + $(#CourseSelect).val(), dataType:'json', cache:false,
        success:function(data)
        { 
            $('#TeacherSelect').get(0).options.length = 0;    

            $.each(data, function(i, teacher) 
            {
                var option = $('<option />');
                option.val(teacher.employeeId);
                option.text(teacher.name);
                $('#TeacherSelect').append(option);
            });
        }, error:function(){ alert("Error while getting results"); }
    });
}

answered Oct 14, 2014 at 10:30

Developer's user avatar

DeveloperDeveloper

3,7474 gold badges37 silver badges46 bronze badges

Hi all, I’m new to Shopify coding. I’ve been trying to handle this JS error for a while but couldn’t solve it.

Here’re the error messages:

jquery.min.js:2 jQuery.Deferred exception: Cannot read property ‘toLowerCase’ of undefined TypeError: Cannot read property ‘toLowerCase’ of undefined
at HTMLDocument.<anonymous> *this code is called via combined.js in theme.liquid after jQuery source code.
at e (https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js:2:29453)
at t (https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js:2:29755) undefined
k.Deferred.exceptionHook @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout (async)
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
B @ jquery.min.js:2

In productpage, it keeps showing warning «Each dictionary in the list «icons» should contain a non-empty UTF8 string field «type».» I’m not sure where should I look into….

Below are the code lines where error messages happened: 

 
//when load show related image only
var altvl = $(".HorizontalList__Item:first-child").children("input").val().toLowerCase();

& if ((e = a.apply(n, r)) === o.promise())

function l(i, o, a, s) {
                        return function() {
                            var n = this
                              , r = arguments
                              , e = function() {
                                var e, t;
                                if (!(i < u)) {
                                    if ((e = a.apply(n, r)) === o.promise())  // ERROR 'at e'
                                        throw new TypeError("Thenable self-resolution");
                                    t = e && ("object" == typeof e || "function" == typeof e) && e.then,
                                    m(t) ? s ? t.call(e, l(u, o, M, s), l(u, o, I, s)) : (u++,
                                    t.call(e, l(u, o, M, s), l(u, o, I, s), l(u, o, M, o.notifyWith))) : (a !== M && (n = void 0,
                                    r = [e]),
                                    (s || o.resolveWith)(n, r))
                                }
                            }

I would very much appreciate your advice and help or even just share the similar problem you encounter, thanks in advance! If I need to provide more details about the error, please leave a comment and I’ll do it ASAP.

The String.toLowerCase() function in JavaScript converts the entire string to lower case. The toLowerCase() function does not affect any of the special characters, digits, and alphabets already in the lower case.

JavaScript string toLowerCase() is a built-in function that returns the calling string value converted to lower case. The toLowerCase() function does not accept any parameter. Instead, the new string representing the calling string is converted to a lower case.

Syntax

string.toLowerCase()

Arguments

The toLowerCase() function does not take any arguments.

Return Value

The toLowerCase() method returns the value of the string converted to lower case. The toLowerCase() function does not affect the value of the string itself.

Example

Let’s define a string using single quotes and then convert it into lowercase.

// app.js

let strA = 'Avengers will be a great movie';
console.log(strA.toLocaleLowerCase());

The toLowerCase()  function does not take any arguments.

It merely returns the new string in which all the upper case letters are converted to the lower case.

Run the file by the following command.

node app

See the output below.

Javascript String toLowerCase Example

This is how you can convert Javascript Strings To Lower Case.

See the following more examples of converting all the string characters to lowercase.

// app.js

console.log('AppDividend'.toLocaleLowerCase());
console.log('KrunalLathiya'.toLowerCase());

String.prototype.toLowerCase() Tutorial

Convert elements of the array to lowercase

To convert an array of elements to lowercase in Javascript, use the combination of join(), toLowerCase(), and split() methods.

let arr = [
  'MILLIE',
  'NOAH',
  'FINN',
  'SADIE'
]

let str = arr.join('~').toLowerCase()
let finArr = str.split('~')
console.log(finArr)

See the output.

➜  es git:(master) ✗ node app
[ 'millie', 'noah', 'finn', 'sadie' ]
➜  es git:(master) ✗

In the above code, we have used the Javascript join() method, the mixed-case array into a string, lowercase it, then Javascript split() the string back into an array.

The above method could cause performance issues if you have a large amount of data in the array.

TypeError: Cannot read property ‘toLowerCase’ of undefined

If you pass the string as an undefined, then you will get this TypeError: Cannot read property ‘toLowerCase’ of undefined.

See the following code.

let str = undefined

let res = str.toLowerCase()
console.log(res)

 See the output.

➜  es git:(master) ✗ node app
/Users/krunal/Desktop/code/node-examples/es/app.js:3
let res = str.toLowerCase()
              ^

TypeError: Cannot read property 'toLowerCase' of undefined
    at Object.<anonymous> (/Users/krunal/Desktop/code/node-examples/es/app.js:3:15)

That’s it for this tutorial.

Recommended Posts

Javascript toUpperCase()

Javascript toLocaleUpperCase()

Javascript toLocaleLowerCase()

  • Remove From My Forums
  • Question

  • User1078534304 posted

    Hi Everyone,

    Please help me on this error. It  seems like i cannot use the ‘toLowerCase’ function from the javascipt.

    my codes:

    /// <reference path="../Scripts/jquery-1.7.1.min.js" />
    /// <reference path="../Scripts/jquery-1.5.2.js" />
    /// <reference path="../Scripts/knockout-2.3.0.js" />
    /// <reference path="../Scripts/knockout-3.1.0.js" />
    /// <reference path="../Scripts/jquery-1.9.0.js" />
    /// <reference path="../Scripts/jquery-2.0.0.js" />
    /// <reference path="../Scripts/jquery-1.10.2.js" />
    
    /* /// <reference path="../Scripts/jquery.js" />
    /// <reference path="../Scripts/jPaginate.js" />
    */
    function CleanData() {
        document.getElementById("txtCustname").value = null;
        document.getElementById("txtCustNRIC").value = null;
        document.getElementById("txtEmail").value = null;
        document.getElementById("txtContactNo").value = null;
    };
    
    function QCust(data) {
        this.custno = ko.observable(data.custno);
        this.custname = ko.observable(data.custname);
        this.custemail = ko.observable(data.custemail);
        this.custclass = ko.observable(data.custclass);
        this.custnric = ko.observable(data.custnric);
        this.custcontact = ko.observable(data.custcontact);
    };
    
    function QCustClass(classdata) {
        this.classid = ko.observable(classdata.classid);
        this.classcode = ko.observable(classdata.classcode);
        this.classdesc = ko.observable(classdata.classdesc);
        this.classisactive = ko.observable(classdata.classisactive);
    };
    
    var QChoiceType = function (choicetype, choicetypedisplay) {
        var self = this;
        self.choicetype = choicetype;
        self.choicetypedisplay = choicetypedisplay;
    };
    
    //ko validations
    ko.extenders.required = function (target, overrideMessage) {
        //add some sub-observables to our observable
        target.hasError = ko.observable();
        target.validationMessage = ko.observable();
    
        //define a function to do validation
        function validate(newValue) {
            target.hasError(newValue ? false : true);
            target.validationMessage(newValue ? "" : overrideMessage || "*");
        }
    
        //initial validation
        validate(target());
    
        //validate whenever the value changes
        target.subscribe(validate);
    
        //return the original observable
        return target;
    };
    
    var QModel = function (questions) {
        var appPath = window.location.pathname;
        var self = this;
        var date = new Date();
        var day = date.getDate();
        var month = date.getMonth() + 1;
        var year = date.getFullYear();
        if (month < 10) month = "0" + month;
        if (day < 10) day = "0" + day;
        var today = year + "-" + month + "-" + day;
    
        self.classid = ko.observable();
        self.classcode = ko.observable();
        self.classdesc = ko.observable();
        self.classisactive = ko.observable();
        self.strsearch = ko.observable();
        self.customers = ko.observableArray();
        filteredcustomers = ko.observableArray();
        searchcustomers = ko.observableArray();
        self.custno = ko.observable();
        self.custname = ko.observable().extend({ required: "*" });
        self.custnric = ko.observable().extend({ required: "*" });
        self.custemail = ko.observable().extend({ required: "*" });
        self.custcontact = ko.observable().extend({ required: "*" });
        self.custdob = ko.observable(today);
        self.custjoindate = ko.observable();
        self.custclass = ko.observable();
        self.custisactive = ko.observable();
        self.isError = ko.observable();
        self.customerclasses = ko.observableArray();
        self.selectedcustomerclass = ko.observable().extend({ required: "*" });
        self.totalitems = ko.observable();
        self.search = ko.observable();
        self.questions = ko.observableArray(
             ko.utils.arrayMap(questions, function (question) {
                 return { formId: question.formId, groupId: question.groupId, qString: question.qString,
                     choices: ko.observableArray(question.choices)
                 };
             })
        );
    
    
        selectedChoiceType = ko.observable();
        availableChoiceType = ko.observableArray([new QChoiceType("checkbox", "Checkbox"),
                                                       new QChoiceType("text", "Text"),
                                                       new QChoiceType("radio", "Option Button")
                                                      ]);
    
        self.ClearFields = function () {
            self.custno = ko.observable();
            self.custname = ko.observable().extend({ required: "*" });
            self.custnric = ko.observable().extend({ required: "*" });
            self.custemail = ko.observable().extend({ required: "*" });
            self.custcontact = ko.observable().extend({ required: "*" });
            self.custdob = ko.observable(today);
            self.custjoindate = ko.observable();
            self.custisactive = ko.observable();
        };
    
        //*** check if customer is existing ***
        self.isCustomerExists = function (customer) {
            var dtJoinDate = new Date();
            var cust = customer;
            $.post(appPath + "/Customers/IsCustomerExisting", cust, function (data) {
                return data;
            });
        };
    
        //*** save customer ***
        self.saveCustomer = function (customer) {
            var cust = customer;
    
            $.post(appPath + "/Customers/SaveCustomer", cust, function (data) {
                var isSaved = (data === "True")
                if (isSaved) {
                    alert("Customer has been added");
                    self.ToggleNewCustomerOff();
                }
                else {
                    alert("Unable to add customer");
                }
            });
        };
    
        self.insertcustomer = function () {
            var dtJoinDate = new Date();
            var cust = {
                CustNo: self.custno,
                CustName: self.custname,
                CustNRIC: self.custnric,
                CustEmail: self.custemail,
                CustContact: self.custcontact,
                CustDOB: self.custdob,
                CustJoinDate: dtJoinDate,
                CustClass: self.selectedcustomerclass,
                CustIsactive: self.custisactive
            };
    
            $.post(appPath + "/Customers/IsCustomerExisting", cust, function (data) {
                var isExisting = (data === "True");
                if (isExisting) {
                    alert("the Customer is already existing");
                }
                else {
                    self.saveCustomer(cust);
                }
            });
        };
    
        self.searchCustomer = function () {
            self.ToggleNewCustomerOff();
    
            var data = {
                search: self.strsearch
            };
    
            $.post(appPath + "/Customers/SearchCustomer", data,
                            function (customerdata) {
                                debugger;
                                var custs = ko.toJSON(customerdata);
                                var mappedData = $.map(customerdata, function (item) {
                                    return new QCust(item);
                                });
                                self.customers(mappedData);
                                self.totalitems = customerdata.length;
                                //                            $("#total_items").attr('value', self.totalitems);
                                //                            $("#content").jPaginate();
                            });
        };
    
        self.updateThis = function (jsonData) {
            var jsonString = JSON.stringify(jsonData);
            var parsed = JSON.parse(jsonString);
            alert(jsonData);
        };
    
        self.addQuestion = function () {
            self.questions.push({
                formId: ko.observable(),
                groupId: ko.observable(),
                qstring: ko.observable(),
                choicetype: ko.observable(),
                choices: ko.observableArray()
            });
        };
    
        self.addChoice = function (questions) {
            questions.choices.push({
                chtype: ko.observable(),
                cstring: ko.observable()
            });
        };
    
        self.removeChoice = function (choice) {
            $.each(self.questions(), function () {
                this.choices.remove(choice)
            })
        };
    
        self.removeQuestion = function (question) {
            self.questions.remove(question);
        };
    
        self.ToggleSearch = function () {
            $("#divNewCustomer").show();
        };
    
        self.ToggleNewCustomerOn = function () {
            self.custname("");
            self.custnric("");
            self.custemail("");
            self.custcontact("");
            self.LoadClass();
            $("#divNewCustomer").show();
            $("#divCustomerList").hide();
        };
    
        self.ToggleNewCustomerOff = function () {
            self.custname("");
            self.custnric("");
            self.custemail("");
            self.custcontact("");
            $("#divNewCustomer").hide();
            $("#divCustomerList").show();
        };
    
        self.saveQuestions = function (question) {
            var qToJSON = ko.toJSON(this);
            alert(qToJSON.toString());
        };
    
        $.post(appPath + "/Customers/GetCustomerLists",
                                function (customerdata) {
                                    debugger;
                                    var mappedData = $.map(customerdata, function (item) {
                                        return new QCust(item);
                                    });
                                    self.customers(mappedData);
                                });
    
        //*** comparison of the string for search ***
        self.filtercustomers = ko.computed(function () {
            var searchText = self.search().toLowerCase;
            if (!searchText) {
                return self.customers();
            }
            else {
                if (self.customers() != 'undefined' && self.customers() != null && self.customers().length > 0) {
                    return ko.utils.arrayFilter(self.customers(),
                        function (cust) {
                            return cust.custname.toLowerCase().indexOf(searchText) > -1;
                        });
                }
            }
        });
    
        //*** end of the comparisons ***
    
        //*** get records from the database
        //    self.LoadData = function () {
        //        debugger;
        //        $.post(appPath + "/Customers/GetCustomerLists",
        //                        function (customerdata) {
        //                            debugger;
        //                            var mappedData = $.map(customerdata, function (item) {
        //                                return new QCust(item);
        //                            });
        //                            self.customers(mappedData);
        //                            self.totalitems = customerdata.length;
        //                            //                            $("#total_items").attr('value', self.totalitems);
        //                            //                            $("#content").jPaginate();                        
        //                        });
        //    };
    
    
        self.LoadClass = function () {
            $.post(appPath + "/Customers/GetCustomerClass",
                    function (customerclass) {
                        var mappedData = $.map(customerclass, function (item) {
                            return new QCustClass(item)
                        });
    
                        self.customerclasses(mappedData);
                    });
        };
    
        $("#divNewCustomer").hide();
    
        filter = ko.observable();
    };
    
    debugger;
    var qm = new QModel();
    var path = window.location.pathname;
    
             
    ko.applyBindings(qm);

    my mvc code:

    <input data-bind="value: search, valueUpdate: 'afterkeyup'" type="text" style="height:30px;width:98%;text-indent:5px;"/>
    
    <div data-bind="foreach: filtercustomers">
       <p data-bind="text: custname"></p>
    </div> 

    Thanks and best regards,

    Nusij

Answers

  • User681112540 posted

    toLowerCase() is a method, you miss the bracket at the end of toLowerCase in your code.

      self.filtercustomers = ko.computed(function () {
            var searchText = self.search().toLowerCase();
            if (!searchText) {
                return self.customers();
            }
    • Marked as answer by

      Thursday, October 7, 2021 12:00 AM

  • User1918509225 posted

    Hi Nusij03,

    You have miss bracket for your toLowerCase method,just like below:

    var str = "Hello World!";
    var res = str.toLowerCase();
    

    not

    var res=str.toLowerCase;

    Here is link which you can refer to :

    http://www.w3schools.com/jsref/jsref_tolowercase.asp

    Best Regards,

    Kevin Shen

    • Marked as answer by
      Anonymous
      Thursday, October 7, 2021 12:00 AM

Heaven_Lord

0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 15

1

23.11.2018, 01:18. Показов 2705. Ответов 5

Метки chorme, extension, n (Все метки)


siteListFake[i].toLowerCase() работает нормально как только добавляю и для siteListReal[i].toLowerCase() перестают работать в чем может быть проблема ?

Javascript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
chrome.tabs.getSelected(null,function(tab) {
var url = new URL(tab.url);
var domain = url.hostname;
var siteListReal = [
                    "www.Google.com",
                    "GOogle.com",
                    "vk.com",
                    "www.youtube.com"
                   ];
var siteListFake = [
                    "site.info",
                    "site.site",
                    "site.com"
            
                    
                 ];
 
var siteLenReal = siteListReal.length;
var siteLenFake = siteListFake.length;
 
for (var i = 0; i <= siteLenReal || i <= siteLenFake; i++) {
 
    if (domain == siteListReal[i] || url == siteListReal[i]){
        document.getElementById("textInfo").innerHTML = "White List"; 
        break;
     } else if (domain == siteListFake[i].toLowerCase() || url == siteListFake[i].toLowerCase()){
            document.getElementById("textInfo").innerHTML = "Black List"; 
            break;
        } else {
            document.getElementById("textInfo").innerHTML = "Nu detinem informatii despre site!"; 
        }
}
    document.getElementById("sourceDomain").innerHTML = domain;
 });

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



565 / 464 / 183

Регистрация: 14.10.2017

Сообщений: 1,259

23.11.2018, 04:01

2

Heaven_Lord, ну так,навскидку-у вас разная длина массивов siteLenReal и siteLenFake, а в цикле вы их запихнули в одно условие i <= siteLenReal || i <= siteLenFake;.
И когда i == 3, происходит обращение к несуществующему элементу siteListFake[3]. А это ошибка. Консоль должна была это показать. Вы заглядывали в консоль?



0



the hardway first

Эксперт JS

2423 / 1808 / 894

Регистрация: 05.06.2015

Сообщений: 3,573

23.11.2018, 08:33

3

Цитата
Сообщение от klopp
Посмотреть сообщение

происходит обращение к несуществующему элементу siteListFake[3]. А это ошибка.

ЕМНИП JavaScript просто вернёт undefined. Не будет брошено исключение обращения за пределы списка, типа «OutOfRange».



0



Heaven_Lord

0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 15

23.11.2018, 16:29

 [ТС]

4

Если Я правильно понял то так должно заработать но тогда ничего не выводит

Javascript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
chrome.tabs.getSelected(null,function(tab) {
var url = new URL(tab.url);
var domain = url.hostname;
var siteListReal = [
                    "www.Google.com",
                    "GOogle.com",
                    "vk.com",
                    "www.youtube.com"
                   ];
var siteListFake = [
                    "site.info",
                    "site.site",
                    "site.com"
            
                    
                 ];
 
var siteLenReal = siteListReal.length;
var siteLenFake = siteListFake.length;
var found = false;
 
for (var i = 0; i <= siteLenReal; i++) {
    if (domain == siteListReal[i].toLowerCase() || url == siteListReal[i].toLowerCase()){
        document.getElementById("textInfo").innerHTML = "White List"; 
        found = true;
        break;
     } 
}
for (var x = 0; x <= siteLenFake; x++) {
     if (domain == siteListFake[x].toLowerCase() || url == siteListFake[x].toLowerCase()){
            document.getElementById("textInfo").innerHTML = "Black List"; 
            found = true;
            break;
        }
}
 
if (!found){
    document.getElementById("textInfo").innerHTML = "Nu detinem informatii despre site!"; 
}
    document.getElementById("sourceDomain").innerHTML = domain;
 });

Добавлено через 5 минут
Error in response to tabs.getSelected: TypeError: Cannot read property ‘toLowerCase’ of undefined



0



565 / 464 / 183

Регистрация: 14.10.2017

Сообщений: 1,259

23.11.2018, 19:01

5

Лучший ответ Сообщение было отмечено Heaven_Lord как решение

Решение

Heaven_Lord,OMG, у вас ошибка в условиях циклов, вместо (var i = 0; i <= siteLenReal; i++) надо (var i = 0; i < siteLenReal; i++), и в другом цикле соответственно

Цитата
Сообщение от j2FunOnly
Посмотреть сообщение

ЕМНИП JavaScript просто вернёт undefined. Не будет брошено исключение обращения за пределы списка, типа «OutOfRange».

в консоли пишет:
Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined



2



0 / 0 / 0

Регистрация: 06.03.2016

Сообщений: 15

23.11.2018, 19:21

 [ТС]

6

Mersi ^_^ Проста я думал что если i < siteLen; то последний сайт не будет обработан



0



0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Cannot read properties of undefined reading length ошибка
  • Cannot read from port ошибка