xiac
xiac

Reputation: 77

Lambda Expression in internet explorer

I am trying to lambda expression should be work in internet explorer. This code does not work on İE but it works on Chrome.

How can I use lambda expression by using function or sth else and call it here?
What should I do trying to work this code?

In below code: (i, e) => does not work in filter method.

Can I assign lambda expression to variable or function?

var query = new RegExp($("#filter").val(), "i");
$(".list-item").hide().filter((i, e) => query.test($(e).text()));

Upvotes: 2

Views: 4920

Answers (1)

Jai
Jai

Reputation: 74738

A simple solution is to change it using a callback with regular anonymous function:

$(".list-item").hide().filter(function(i, e){
    return query.test($(e).text());
});

Thing to note is that the IE browser which you are using might not implemented these ES6 features yet. So, better using a latest browser like chrome, Firefox, IE-edge etc.

Upvotes: 3

Related Questions