1

JSBin Link

When I run the code in the jsBin, I get the following object churned out:

  Game Modding: [[object Object] {
  event_type: "program",
  icon: "game-modding",
  title: "Game Modding",
  type: "info"
}, [object Object] {
  event_type: "program",
  icon: "game-modding",
  title: "Game Modding",
  type: "info"
}, [object Object] {
  event_type: "program",
  icon: "game-modding"
  title: "Game Modding",
  type: "info"
}]

I need to get the [object Object] out of there, but after an hour of Google searching I'm not seeing anything that is telling me why it's showing up like this.

I'm using underscore to render and filter the data, and so far it's come together pretty quickly but this object Object thing is getting in the way of actually using my data. The whole point of this is that I'm trying to group events I'm given by their name and show the times that every event is offered and a single description of the event.

Any help is extremely appreciated!

0

2 Answers 2

3

This is most likely a weird choice from the JSBin side of things.

If you try your code in the Chrome Console (for example), you will be able to see your list in perfect order.

Other people have reported similar issues:

https://github.com/jsbin/jsbin/issues/2310

Sign up to request clarification or add additional context in comments.

Comments

2

JSBin is coercing the object to a string in order to print it in their console.

If you open up your dev tools console in your browser, you'll see that it's working as expected (you hit CMD+opt+j to open up Chrome dev tools on Mac, for example):

output

Just as an aside, whenever you try to "print" an object to the screen, the browser will call the object's .toString method:

var myObj = {};

someDOMElement.innerHTML = myObj;

// => on the screen, you'll see [object Object]

1 Comment

Thank you so much, this was exactly the issue. I messed with this for an hour and a half, and I had it right all along haha. Thank you again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.