File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff 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)**
You can’t perform that action at this time.
0 commit comments