Skip to content

Commit 418c77a

Browse files
author
krishna9802
committed
first code snippet addded
1 parent 5d79fa2 commit 418c77a

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ One liner clean code snippets in javascript/react with ES6 syntax
2222
We are injecting the new property at time of defining the object only
2323

2424
```javascript
25-
const is_employee=true;
26-
const student={
25+
const is_employee=true;
26+
27+
const student={
2728
name:'Krishna Kant',
2829
roll:'AD203',
2930
stream:'MERN stack web development',
3031
...(is_employee && {company:'Inventives.ai})
31-
}
32+
}
3233
```
3334
3435
2. **After object has been defined**
@@ -38,13 +39,13 @@ One liner clean code snippets in javascript/react with ES6 syntax
3839
```javascript
3940
const is_employee=true;
4041
let student={
41-
name:'Krishna Kant',
42-
roll:'AD203'
42+
name:'Krishna Kant',
43+
roll:'AD203'
44+
}
45+
student={
46+
...student,
47+
...(is_employee && {company: 5})
4348
}
44-
is_employee && student={
45-
...student,
46-
company:'Inventives.ai'
47-
}
4849
```
4950
5051
**[⬆ Back to Top](#table-of-contents)**

0 commit comments

Comments
 (0)