Symbol undefined IE11

Yes, I’ve duckduckgo’d extensively. What it comes down to is that I have this sort of code…A polyfill for IE11 object entries, and then 2 for loops.

if (!Object.entries) {
      console.log("polyfill running");
      Object.entries = function( obj ){
        var ownProps = Object.keys( obj ),
            i = ownProps.length,
            resArray = new Array(i); // preallocate the Array
        while (i--)
          resArray[i] = [ownProps[i], obj[ownProps[i]]];
        return resArray;

      if(_.find(".fsCalendar").length > 1) {
        multipleCalendars = true;
        $('<ul class="dropdown-wrapper"/>').insertBefore($(this).find("> .fsElementContent"));
        // for(let [key, value] of Object.entries(dropdownData)) {
        //   $('<li class="'+key+'"><button>'+value+'</button></li>').appendTo(_.find(".dropdown-wrapper"));
        // }
        // _.find(".dropdown-wrapper > li").first().addClass("active-category");

          for(let [key, value] of Object.entries(dropdownData)) {
          //   if(self.attr("class").split(" ").includes(key)) {
          //     if(!_.find(".dropdown-wrapper li."+key).find(".sublist").length) {
          //       _.find(".dropdown-wrapper li."+key).append('<div class="sublist"/>');
          //     }
          //     _.find(".dropdown-wrapper li."+key+" .sublist").append("<li><button>"+schoolTitleText+"</button></li>");
          //   }

However, running either of these for loops gives me an error in IE11 saying Symbol is undefined. I have es6-symbol node module installed and I tried doing this (the unrecommended version but this is the code to make the polyfill run universally. I was just trying to force the polyfill to run.

var Symbol = require("es6-symbol/polyfill");

I’m just about out of options here…not sure how I can fix this :frowning: .

IE11 doesn’t support for..of… it’s not your Object.entries call it’s complaining about?

1 Like

Correct, my entries call SHOULD be fine - I have the polyfill in place to support IE11.

How can I support for..of for IE11 then?

Edit - Or will this need rewriting to not even use for..of ? Not sure if there’s a polyfill.

Maybe i’m missing the point, but wouldnt all of this just be

for (key in dropdownData) {
$('<li class="'+key+'"><button>'+dropdownData[key]+'</button></li>').appendTo(_.find(".dropdown-wrapper"));


You’re turning an object into an array to walk it… but a for…in loop already walks an object?

1 Like

Just me being uneducated as to the proper purpose :slight_smile: . I changed that loop, rewrote includes to use indexOf (IE11 doesn’t support that either apparently) and we’re all set!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.