File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ // 5. De-Structuring Object,
2
+
3
+ /* Destructuring objects in JavaScript is a convenient way to extract properties
4
+ from objects and assign them to variables. This syntax simplifies accessing data
5
+ within objects and helps you write cleaner and more readable code. */
6
+
7
+ const course = {
8
+ courseName : "Learn Javascript" ,
9
+ price : "Free" ,
10
+ courseInstructor : "Ayush"
11
+ }
12
+ // const {courseInstructor, price} = course
13
+ const { courseInstructor : instructor } = course
14
+ console . log ( instructor ) ; // Output: Ayush
15
+
16
+ /*--------------------------------------------------------------------------------
17
+ JSON (Javascript Object Notation),
18
+ API can provide data in a structured format such as JSON,
19
+ JSON's structure is easy for humans to read and understand,
20
+
21
+ {
22
+ "name": "Ayush",
23
+ "courseName": "JS Hindi",
24
+ "price": "Free"
25
+ }
26
+
27
+ The given JSON data is an array of three empty objects,
28
+
29
+ [
30
+ {},
31
+ {},
32
+ {}
33
+ ]
34
+ */
You can’t perform that action at this time.
0 commit comments