Object keys and values
π Scenario: You work in a small shop and keep track of products and their prices in an object. You want to see all the product names and their prices separately.
π― Goal: Learn how to get all keys and values from an object using JavaScript.
π What You'll Learn
Create an object called
products with exact keys and valuesCreate a variable called
productNames to hold the keys of productsCreate a variable called
productPrices to hold the values of productsPrint both
productNames and productPrices to see the listsπ‘ Why This Matters
π Real World
Objects are used to store related data like product lists, user profiles, or settings in many web applications.
πΌ Career
Knowing how to access keys and values in objects is essential for frontend and backend developers working with data structures.
Progress0 / 4 steps