-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb.js
More file actions
34 lines (28 loc) · 822 Bytes
/
b.js
File metadata and controls
34 lines (28 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*** 2. You have an object representin a customer order with properties orderId, productName, and quantity.
Use destructurin to extract and print these properties. */
const order = {
orderId: 12345,
productName: 'Laptop',
quantity: 2
};
// Without destructuring
console.log("without destructing");
console.log("order id:", order.orderId);
console.log("Product name:",order.productName);
console.log("Quantity:",order.quantity);
// With destructuring
console.log("with destructing");
console.log("order id:", order.orderId);
console.log("Product name:",order.productName);
console.log("Quantity:",order.quantity);
/***output
without destructing
order id: 12345
Product name: Laptop
Quantity: 2
with destructing
order id: 12345
Product name: Laptop
Quantity: 2
*
*/