简体   繁体   English

获取小于 30 的值和键

[英]Get values ​and keys less than 30

I'm trying to fetch the values from the list when the value is less than thirty days?当值小于三十天时,我试图从列表中获取值?

var list = 
[
    [ '*.cervepar.com.py', 45 ],
    [ '*.fnc.com.uy', 44 ],
    [ '*.btg360.com.br', 369 ],
    [ '*.reservapto.com.br', 361 ],
    [ '*.koerich.com.br', 550 ],
    [ '*.compasso.com.br', 162 ],
    [ '*.compasso.com.br', 162 ],
    [ '*.cbn.com.bo', 21 ],
    [ '*.compassouol.com', 203 ],
    [ '*.cerchile.cl', 443 ],
    [ '*.compasso.com.br', 162 ]
]

You can use .filter like this:您可以像这样使用.filter

 var list = [ [ '*.cervepar.com.py', 45 ], [ '*.fnc.com.uy', 44 ], [ '*.btg360.com.br', 369 ], [ '*.reservapto.com.br', 361 ], [ '*.koerich.com.br', 550 ], [ '*.compasso.com.br', 162 ], [ '*.compasso.com.br', 162 ], [ '*.cbn.com.bo', 21 ], [ '*.compassouol.com', 203 ], [ '*.cerchile.cl', 443 ], [ '*.compasso.com.br', 162 ] ]; let filteredArr = list.filter(x => x[1] < 30); console.log(filteredArr);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM