Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140817

How to perform case-insensitive in array of arrays in JavaScript?

$
0
0

I have an array of arrays. I need to set an array of arrays in a case-insensitive way. How to perform this?

I've got this array and I need to set it to lowercase.


   var criminals = [
        ["Paul White", "Roger Night, Peter Llong Jr."], 
        ["Roger Fedexer", "Rob Ford, Pete Lord, Roger McWire"],
        ["Paul White Jr.", null],
        ["Red Fortress", "Roger Rabbit, Ross Winter"],
        ["Redford Fort", "Red Strong, Red Fort"]
    ];

I've tried this


  var sorted = [];
    for (let i = 0; i < criminals.length; i++) {
        sorted.push(criminals[i].toLowerCase());

        console.log(sorted)
   } 

But I got the following

TypeError: criminals[i].toLowerCase is not a function


Viewing all articles
Browse latest Browse all 140817

Latest Images

Trending Articles



Latest Images