FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScriptNote/basic/Array.js at master · mbrsagor/JavaScriptNote · GitHub
mbrsagor
/
JavaScriptNote
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
5
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
JavaScriptNote
/
basic
/
Array.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (41 loc) · 1.19 KB
Breadcrumbs
JavaScriptNote
/
basic
/
Array.js
Copy path
File metadata and controls
55 lines (41 loc) · 1.19 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
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
names
=
[
"mbr-sagor"
,
"zia-uddin"
,
"saif-nirob"
,
"russel-mahmud"
]
;
names
[
names
.
length
]
=
"hello-happened"
;
// Add data/data in array
names
.
push
(
"Abdul-Goni"
)
;
// Add data in array using another way
console
.
log
(
names
)
;
console
.
log
(
'\n'
)
;
names
.
pop
(
)
;
console
.
log
(
names
)
;
// console.log(names.length)
console
.
log
(
'\n===================='
)
;
var
item1
=
[
"book"
,
"pen"
,
"something"
]
;
var
item2
=
[
"anything"
]
;
var
newItem
=
item1
.
pop
(
)
;
item2
.
push
(
newItem
)
;
console
.
log
(
item1
,
item2
)
;
const
numbers
=
[
1
,
2
,
3
,
4
,
5
]
const
index
=
numbers
.
indexOf
(
2
)
;
// const added = [10, ...numbers]; // add new
const
added
=
[
...
numbers
.
slice
(
0
,
index
)
,
10
,
40
]
console
.
log
(
added
)
;
// Removing
const
remove
=
numbers
.
filter
(
n
=>
n
!==
5
)
;
console
.
log
(
remove
)
;
// Updating
const
update
=
numbers
.
map
(
n
=>
n
===
2
?
20
:
n
)
;
console
.
log
(
update
)
;
// Simple array iteate
let
books
=
[
'Python'
,
'JavaScript'
,
'Java'
,
'Swift'
,
'Dart'
]
;
for
(
let
book
of
books
)
{
console
.
log
(
book
)
;
}
console
.
log
(
books
)
;
let
currentMemeber
=
is_active
=>
{
return
(
is_active
?
'Active Member'
:
'Deactive Member'
)
;
}
console
.
log
(
currentMemeber
(
true
)
)
;
let
age
=
19
;
let
can_drive
=
age
>
16
?
"yes"
:
"no"
;
console
.
log
(
can_drive
)
;
Back
|
FazBrowse Home
|
New Git URL