Announcement

Collapse
No announcement yet.

Java script Question: How to retrieve filter value from batKicks variable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Java script Question: How to retrieve filter value from batKicks variable

    var sidekicks = [
    { name: "Robin", hero: "Batman" },
    { name: "Supergirl", hero: "Superman" },
    { name: "Oracle", hero: "Batman" },
    { name: "Krypto", hero: "Superman" }
    ];
    var batKicks = sidekicks.filter(function (el) {
    return (el.hero === "Batman");
    });

    logger.debug("batKicks"); // It doesn't work .

  • #2
    You're sending it as a string, so it should be logging "batKicks."

    Take off the quotes to reference the variable. Since it's an array of objects, you'll probably want to convert to JSON first to log it.

    Code:
    logger.debug(JSON.stringify(batKicks));

    Comment

    Working...
    X