How can I apply a filter inside a 'for...in' statement?
In other words, I want to iterate only some of the keys of an object.
It's pretty easy with a for...of
statement, for example:
for (const key of Object.keys(obj).filter(key => key.startsWith("0x"))) {
...
}
But I want to use for (const key in obj)
instead.
How can I apply a filter
inside that statement?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…