I have following code ( HERE is editable example - usage: type in input field and watch console):
function test(event)
{
let keys = Object.keys(event);
let keysOwnProp = Object.getOwnPropertyNames(event);
let keysForIn=[]; for(let k in event) { keysForIn.push(k); }
console.log('keysForIn',keysForIn);
console.log('keys',JSON.stringify(keys));
console.log('keysOwnProp',JSON.stringify(keysOwnProp));
}
<input oninput="test(event)" placeholder="type something">
Questions:
- Why only in
keysForInI see all(?) event fields/properties, but inkeysandkeysOwnProponly one:isTrusted? - Is there an alternative for
keysForIn(if yes, provide it) ?