I know that Typescript use ES6 or ES2015.
And I know that anArray.includes('ifExist'); only available in ES6.
But why can't I use it when I use Typescript?
It says that anArray don't have a method includes.
My Array
anArray = [
{
'category': 'x',
'data': []
},
{
'category': 'y',
'data': []
},
{
'category': 'z',
'data': []
}
];
ifExist variable
ifExist = {
'category': 'a',
'data': []
};
If I use anArray.indexOf(isExist) < 0, I can get the result like anArray.includes(isExist).
anArrayis probably not typed as an array. You need to provide code that reproduces the problem