📜  检查对象中的许多键 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:48.384000             🧑  作者: Mango

代码示例1
const neededKeys = ['oldPassword', 'name', 'newPassword'];

const obj = {
    "name": "admin@test.org",
    "oldPassword": "1234",
    "newPassword": "12345"
}

console.log(neededKeys.every(key => Object.keys(obj).includes(key)));