typescript object key from other object
const object: {
[K in keyof MyInterface]: any
} = {}
typescript object key from other object
const object: {
[K in keyof MyInterface]: any
} = {}
typescript object get value by key
myObj = {
policy: {
index: 1,
page: "/policy"
},
purchase: {
index: 2,
page: "/purchase"
}
}
// get value on key
Object.keys(myObj).forEach(key => {
if (myObj[key].index === 2) {
console.log("Found.");
}
});
// If you want to stop the search when one was found
Object.keys(myObj).some(key => myObj[key].index === 2);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us