Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Basic
- # Advanced
- # Expert
- ## Reading keys and their values from an object
- const object = {
- "key": "value",
- "key2": "value2",
- }
- for (const key in object) {
- if (object.hasOwnProperty(key)) {
- const value = object[key];
- console.log("Key:", key);
- console.log("Value:", value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement