Mic*_*ley 0 typescript ecmascript-6
我知道 Typescript 使用 ES6 或 ES2015。
而且我知道这anArray.includes('ifExist');仅在 ES6 中可用。
但是为什么我在使用Typescript时不能使用它?它说anArray没有方法includes。
我的数组
anArray = [
{
'category': 'x',
'data': []
},
{
'category': 'y',
'data': []
},
{
'category': 'z',
'data': []
}
];
Run Code Online (Sandbox Code Playgroud)
ifExist 变量
ifExist = {
'category': 'a',
'data': []
};
Run Code Online (Sandbox Code Playgroud)
如果我使用anArray.indexOf(isExist) < 0,我可以得到类似的结果anArray.includes(isExist)。
| 归档时间: |
|
| 查看次数: |
2076 次 |
| 最近记录: |