Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:37:34+00:00 2026-06-05T11:37:34+00:00

Other browsers work fine but in IE i get Number Expected when using the

  • 0

Other browsers work fine but in IE i get Number Expected when using the following code and it runs into a null object on the sort function.
http://jsfiddle.net/R3ndd/2/

function list_response(jsonData) {
"use strict";
var lists = document.getElementById("lists"), anchors =     document.getElementById("anchors"), jItems = jsonData.items;
var results = [], anks = [], vList, pListName, item, videoItem;

var i, j, jLen, iLen = jItems.length;
for (var i = 0; i < iLen; i++) {
    if(jItems[i] != null ){
    jItems[i].nameLower = jItems[i].name.toLowerCase();
    }
}

jItems.sort(function (a, b) {
    if(a != null && b != null){
    return a.nameLower.localeCompare(b.nameLower);
    }
});

Any suggestions? Thanks!

My Solution

I decided to remove the null object (which works) from json using the following:

var y;
for (var x in jItems) {
    if ( Object.prototype.hasOwnProperty.call(jItems,x)) {
        y = jItems[x];
        if (y==="null" || y===null || y==="" || typeof y === "undefined") {
            delete jItems[x];
        }

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:37:35+00:00Added an answer on June 5, 2026 at 11:37 am

    Don’t know why IE does that, but it is it’s habit to trouble us good people :). Well, I think this will be better way.

    /* NOT NEEDED.
    for (var i = 0; i < iLen; i++) {
        if(jItems[i] != null ){
        jItems[i].nameLower = jItems[i].name.toLowerCase();
        }
    }*/
    
    jItems.sort(function (a, b) {
        return a && b ? a.toLowerCase().localeCompare(b.toLowerCase()) : 0;
    });
    

    UPDATE:

    Well, I think I know where IE is troubling. Sorry MS, this time IE hasn’t any fault. What happened was that in case where either a or b were null/''/false (or any falsy value), your callback didn’t return any value. That explians the ‘Number expected’ error. But I took care of that, so my answer will probably work. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with IE. All other browsers work fine, but in IE
I'm returning some Json via a C# MVC Controller. Other browsers work fine, but
I have some login code that works well for Firefox and other browsers, but
In other browsers no problem at all. But in chroom when i hover on
I don't know what happened to my Firefox (other browsers working fine). I tried
Having some trouble w/ IE7. IE8, Chrome, Firefox all work fine, but IE7 won't
Apparently the font Arvo is supposed to work fine in IE, but I can't
This little web page runs fine on my desktop but when selecting the area
This works in all other browsers and I have no idea what the problem
I sometimes need to debug JS in other browsers, and it would be really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.