FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Every_Thing_You_Need_To_Know_React/arrayAddOrRemove.js at main · ShuvoProgram/Every_Thing_You_Need_To_Know_React · GitHub
ShuvoProgram
/
Every_Thing_You_Need_To_Know_React
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Every_Thing_You_Need_To_Know_React
/
arrayAddOrRemove.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
17 lines (17 loc) · 1.03 KB
Breadcrumbs
Every_Thing_You_Need_To_Know_React
/
arrayAddOrRemove.js
Copy path
File metadata and controls
17 lines (17 loc) · 1.03 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// add or remove from an array
const
products
=
[
{
name
:
'laptop'
,
price
:
3200
,
brand
:
'len'
,
color
:
'silver'
}
,
{
name
:
'phone'
,
price
:
7000
,
brand
:
'HTC'
,
color
:
'golden'
}
,
{
name
:
'watch'
,
price
:
3000
,
brand
:
'casio'
,
color
:
'yellow'
}
,
{
name
:
'sungalss'
,
price
:
300
,
brand
:
'ray'
,
color
:
'black'
}
,
{
name
:
'camera'
,
price
:
9000
,
brand
:
'canon'
,
color
:
'gray'
}
]
;
// array তে একটা অবজেক্ট এলিমেন্টকে যোগ করতে হলে ... সেই array তার সাথে newArray কে add করে দিতে হবে।
const
newProduct
=
{
name
:
'webcam'
,
price
:
2000
,
brand
:
'lal sing chadda'
,
color
:
'red'
}
;
// add product
const
addProduct
=
[
...
products
,
newProduct
]
;
// console.log(addProduct);
// array এর এলিমেন্টের ডিলিট করতে চাইলে আমরা এই মেথড ব্যবহার করবো।
// remove product
const
removeProduct
=
products
.
filter
(
p
=>
p
.
name
!=
'laptop'
)
;
console
.
log
(
removeProduct
)
;
Back
|
FazBrowse Home
|
New Git URL