const electronicProducts = {
product1: {
name: "Laptop",
brand: "Apple",
price: 1500,
specifications: {
processor: "Intel Core i7",
memory: "16GB RAM",
storage: "512GB SSD",
ports: ["USB-C", "HDMI", "Thunderbolt"],
},
features: ["Retina Display", "Touch ID", "Backlit Keyboard"],
},
product2: {
name: "Smartphone",
brand: "Samsung",
price: 1000,
specifications: {
screen: "6.5-inch AMOLED",
camera: "Triple Camera Setup",
battery: "4500mAh",
colors: ["Black", "White", "Blue"],
},
features: ["Wireless Charging", "Water Resistant", "Face Recognition"],
},
product3: {
name: "Smart TV",
brand: "LG",
price: 2000,
specifications: {
screen: "55-inch OLED",
resolution: "4K Ultra HD",
operatingSystem: "WebOS",
sizeOptions: ["55-inch", "65-inch", "75-inch", "85-inch"],
},
features: ["AI ThinQ", "Built-in Voice Control", "Cinema HDR"],
},
product4: {
name: "Headphones",
brand: "Sony",
price: 300,
specifications: {
type: "Over-Ear",
wireless: true,
noiseCancellation: true,
colors: ["Black", "White", "Blue", "Red"],
},
features: ["Hi-Res Audio", "30-hour Battery Life", "Quick Charge"],
},
product5: {
name: "Gaming Console",
brand: "Microsoft",
price: 500,
specifications: {
storage: "1TB",
resolution: "4K",
controller: "Wireless",
graphicsCard: ["RTX 3060", "Radeon RX 6600", "AMD Graphics Core Next"],
},
features: ["Xbox Game Pass", "Backward Compatibility", "HDR Gaming"],
},
};
-
Problem: Access the brand of the Laptop.
- Expected Output:
Apple
- Expected Output:
-
Problem: Retrieve the specifications of the Smartphone.
- Expected Output:
Object { screen: "6.5-inch AMOLED", camera: "Triple Camera Setup", battery: "4500mAh", colors: ["Black", "White", "Blue"] }
- Expected Output:
-
Problem: Find the price of the Smart TV.
- Expected Output:
2000
- Expected Output:
-
Problem: Access the features of the Headphones.
- Expected Output:
["Hi-Res Audio", "30-hour Battery Life", "Quick Charge"]
- Expected Output:
-
Problem: Retrieve the controller type of the Gaming Console.
- Expected Output:
Wireless
- Expected Output:
-
Problem: Change the price of the Laptop to 1700.
- Expected Output:
1700
- Expected Output:
-
Problem: Add a new color ("Silver") to the colors of the Smartphone.
- Expected Output:
["Black", "White", "Blue", "Silver"]
- Expected Output:
-
Problem: Remove the "Water Resistant" feature from the Smartphone.
- Expected Output:
["Wireless Charging", "Face Recognition"]
- Expected Output:
-
Problem: Add a new product ("Tablet") to the electronicProducts object.
- Expected Output:
Object { name: "Tablet", brand: "Unknown", price: 0, specifications: {}, features: [] }
- Expected Output:
-
Problem: Retrieve the size options available for the Smart TV.
- Expected Output:
["55-inch", "65-inch", "75-inch", "85-inch"]
- Expected Output:
-
Problem: Check if the Laptop has a "Touch ID" feature.
- Expected Output:
true
- Expected Output:
-
Problem: Update the storage of the Gaming Console to "2TB".
- Expected Output:
"2TB"
- Expected Output:
-
Problem: Remove the "Built-in Voice Control" feature from the Smart TV.
- Expected Output:
["AI ThinQ", "Cinema HDR"]
- Expected Output:
-
Problem: Add a new feature ("Bluetooth 5.0") to the Headphones.
- Expected Output:
["Hi-Res Audio", "30-hour Battery Life", "Quick Charge", "Bluetooth 5.0"]
- Expected Output:
-
Problem: Find all the available ports for the Laptop.
- Expected Output:
["USB-C", "HDMI", "Thunderbolt"]
- Expected Output:
-
Problem: Check if the Headphones come in a "Red" color.
- Expected Output:
false
- Expected Output:
-
Problem: Retrieve the names of all products in electronicProducts.
- Expected Output:
["product1", "product2", "product3", "product4", "product5", "product6"]
- Expected Output:
-
Problem: Remove the "Radeon RX 6600" graphics card from the Gaming Console.
- Expected Output:
["RTX 3060", "AMD Graphics Core Next"]
- Expected Output:
-
Problem: Check if the Smartphone specifications include "AMOLED" screen.
- Expected Output:
true
- Expected Output:
-
Problem: Add a new specification ("weight: 1.5kg") to the Laptop.
- Expected Output:
Object { processor: "Intel Core i7", memory: "16GB RAM", storage: "512GB SSD", ports: ["USB-C", "HDMI", "Thunderbolt"], weight: "1.5kg" }
- Expected Output:
-
Problem: Retrieve the names of products with a price less than $1000.
- Expected Output:
["product2", "product4", "product5"]
- Expected Output:
-
Problem: Change the brand of the Headphones to "Bose".
- Expected Output:
"Bose"
- Expected Output:
-
Problem: Find the resolution of the Smart TV.
- Expected Output:
"4K Ultra HD"
- Expected Output:
-
Problem: Remove the "HDR Gaming" feature from the Gaming Console.
- Expected Output:
["Xbox Game Pass"]
- Expected Output:
-
Problem: Check if the Gaming Console has a "Blu-ray" drive.
- Expected Output:
false
- Expected Output:
-
Problem: Add a new specification ("frontCamera: 8MP") to the Smartphone.
- Expected Output:
Object { screen: "6.5-inch AMOLED", camera: "Triple Camera Setup", battery: "4500mAh", colors: ["Black", "White", "Blue"], frontCamera: "8MP" }
- Expected Output:
-
Problem: Retrieve the colors available for the Headphones.
- Expected Output:
["Black", "White", "Blue", "Red"]
- Expected Output:
-
Problem: Check if the Laptop has a "Dedicated GPU" specification.
- Expected Output:
false
- Expected Output:
-
Problem: Remove the "Backward Compatibility" feature from the Gaming Console.
- Expected Output:
["Xbox Game Pass"]
- Expected Output:
-
Problem: Calculate the total price of all electronic products.
- Expected Output:
5300
- Expected Output:
-
Problem: Add a new product ("Camera") with a price of $800 and no specifications or features.
- Expected Output:
Object { name: "Camera", brand: "Unknown", price: 800, specifications: {}, features: [] }
- Expected Output:
-
Problem: Change the resolution of the Smart TV to "8K Ultra HD".
- Expected Output:
"8K Ultra HD"
- Expected Output:
-
Problem: Check if the Laptop has a "Backlit Keyboard" feature.
- Expected Output:
true
- Expected Output:
-
Problem: Remove the "Wireless Charging" feature from the Smartphone.
- Expected Output:
["Water Resistant", "Face Recognition"]
- Expected Output:
-
Problem: Retrieve the names of products with more than three features.
- Expected Output:
["product1", "product2", "product3", "product5"]
- Expected Output:
-
Problem: Add a new color ("Green") to the colors of the Headphones.
- Expected Output:
["Black", "White", "Blue", "Red", "Green"]
- Expected Output:
-
Problem: Check if the Smart TV has an "OLED" screen.
- Expected Output:
true
- Expected Output:
-
Problem: Retrieve the type of headphones (Over-Ear, In-Ear, etc.).
- Expected Output:
"Over-Ear"
- Expected Output:
-
Problem: Add a new feature ("Fingerprint Scanner") to the Smartphone.
- Expected Output:
["Wireless Charging", "Water Resistant", "Face Recognition", "Fingerprint Scanner"]
- Expected Output:
-
Problem: Find the size of the screen for the Smartphone.
- Expected Output:
"6.5-inch"
- Expected Output:
-
Problem: Check if the Headphones have a "Microphone" feature.
- Expected Output:
false
- Expected Output:
-
Problem: Remove the "AI ThinQ" feature from the Smart TV.
- Expected Output:
["Built-in Voice Control", "Cinema HDR"]
- Expected Output:
-
Problem: Retrieve the names of products with a price greater than $1000 and less than $2000.
- Expected Output:
["product1", "product3"]
- Expected Output:
-
Problem: Change the color of the Smartphone to "Gold".
- Expected Output:
["Black", "White", "Blue", "Gold"]
- Expected Output:
-
Problem: Check if the Laptop has a "USB-C" port.
- Expected Output:
true
- Expected Output:
-
Problem: Remove the "30-hour Battery Life" feature from the Headphones.
- Expected Output:
["Hi-Res Audio", "Quick Charge", "Bluetooth 5.0"]
- Expected Output:
-
Problem: Retrieve the names of products with a "Wireless" controller.
- Expected Output:
["product5"]
- Expected Output:
-
Problem: Add a new specification ("refreshRate: 120Hz") to the Smart TV.
- Expected Output:
Object { screen: "55-inch OLED", resolution: "4K Ultra HD", operatingSystem: "WebOS", sizeOptions: ["55-inch", "65-inch", "75-inch", "85-inch"], refreshRate: "120Hz" }
- Expected Output:
-
Problem: Check if the Headphones have a "Noise Cancellation" feature.
- Expected Output:
true
- Expected Output:
-
Problem: Remove the "Xbox Game Pass" feature from the Gaming Console.
- Expected Output:
["Backward Compatibility", "HDR Gaming"]
- Expected Output: