-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray.js
31 lines (26 loc) · 767 Bytes
/
array.js
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
// 1(Array)
const country = 'Bangladesh';
const age = 52;
const isIndependent = true;
const student = {id: 121, class: 11, name: 'Agun'};
const friends = [13, 14, 11, 17, 21, 16, 15, 20];
function add(num1, num2){
return num1 + num2;
}
console.log(typeof country);
console.log(typeof age);
console.log(typeof isIndependent);
console.log(typeof student);
console.log(typeof friends);
// check array using Array.isArray
console.log(Array.isArray(friends));
console.log(typeof add);
// Array Index Existing Checking
console.log(friends.includes(19));
console.log(friends.includes(21));
if(friends.indexOf(252) !== -1 ){
}
// Array Concatenation :
const newFriendsAge = [12, 13, 11, 13]
const allFriends = newFriendsAge.concat(friends);
console.log(allFriends)