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
keysForIn
I see all(?) event fields/properties, but inkeys
andkeysOwnProp
only one:isTrusted
? - Is there an alternative for
keysForIn
(if yes, provide it) ?