-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray1.js
More file actions
40 lines (37 loc) · 1.19 KB
/
Copy patharray1.js
File metadata and controls
40 lines (37 loc) · 1.19 KB
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
//? array
//? collection of data
//? statically typed language => c ,java,c++
//? ==> array is collection of data of same type
//? dynamic language==>javascript,python
//? array is collection of data of any type
// const x=[1,"hello",null,undefined,{name:"Nepal"}];
// console.log(x,typeof x);
//? We use array with same data types in real world use case.
// const temperatureList = [10, 20, 28, 22];
// console.log(temperatureList);
// const nations = ["Nepal", "Sri lanka", "India", "USA", "Bangladesh"];
// console.log(nations);
//? values in array can be accessed with index,index always starts with 0
// const laptopBrands = ["Asus", "MSI", "Apple", "Acer", "Dell"];
// console.log(laptopBrands[2]);
// console.log(laptopBrands.length);
// const bakeryItems = [
// "black forest",
// "white forest",
// "red velvet",
// "blueberry",
// "caramel",
// ];
// // console.log(bakeryItems[4])
// for (let i = 0; i <= bakeryItems.length - 1; i++) {
// console.log(bakeryItems[i]);
// }
// const obj = {
// 0: "Apple",
// 1: "Banana",
// 2: "Mango",
// 3: "Orange",
// };
// console.log(obj[0]);
const obj=["Apple","Banana","Mango","Orange"]
//? numeric key vako object can also be represented as array