Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
118 lines (83 loc) · 2.83 KB
/
Copy pathapp.js
File metadata and controls
118 lines (83 loc) · 2.83 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// var arr=["Nokia","Apple","Samsung","Oppo","Redmi","Tecno"];
// document.write(
// "<select>" +
// "<option>" +
// arr[0] +
// "</option>" +
// "<option>" +
// arr[2] +
// "</option>" +
// "<option>" +
// arr[1] +
// "</option>" +
// "<option>" +
// arr[3] +
// "</option>" +
// "<option>" +
// arr[4] +
// "</option>" +
// "<option>" +
// arr[5] +
// "</option>" +
// "<select>"
// );\
// var animals =["Dog","Cat","Lion","Cheetah","Snake","Elephant"];
// var userinput = prompt("Enter value at the last of Array");
// var userinput1 = prompt("Enter value at the last of Array");
// var userinput2 = prompt("Enter value at the last of Array");
// var userinput3 = prompt("Enter value at the last of Array");
// var userinput4 = prompt("Enter value at the last of Array");
// var userinput5 = prompt("Enter value at the last of Array");
// animals.push(userinput,userinput1,userinput2,userinput3,userinput4,userinput5);
// console.log(animals)
// var animals = ["Dog", "Cat", "Lion", "Cheetah", "Snake", "Elephant"];
// var targetIndex = prompt("Enter value to target the index of array");
// var deletedIndex = prompt("Enter how many values to remove");
// var addingElement = prompt("Enter Elements");
// var addingElement2 = prompt("Enter Elements");
// var addingElement3 = prompt("Enter Elements");
// animals.splice(
// targetIndex,
// deletedIndex,
// addingElement,
// addingElement2,
// addingElement3
// );
// console.log("Updated Array", animals);
// var animals=["Babar","Shadab","Shaheen","Zaman","Haris Rauf"];
// var startingvalue = prompt("Enter Starting Value");
// var endingvalue = prompt("Enter Ending Value");
// animals.slice(startingvalue,endingvalue);
// console.log("Updated Array:",animals.slice(startingvalue,endingvalue));
// for (var i=0; i <=10; i = i+2)
// {
// console.log(i);
// }
// var userInput = +prompt("Enter a number to generate a multiplication table");
// var tablelength=+prompt("Enter table Length")
// for (var i=1; i <= tablelength; i++)
// {
// document.write(userInput + "x" + i + "=" + userInput * i + "<br>")
// };
// var arr = ["abc", 100, true, false, "xyz"];
// for (var i = 0;i < arr.length; i++)
// {
// console.log(arr[i]);
// }
// var fruits = ["Banana","Mango","Apple","Orange","Grapes","PineApple"];
// for(var i = 0; i <fruits.length; i++){
// console.log("Elements of " + fruits[i] + " at " + " " + i)
// }
// Chapter no1 ARRAYS AND LOOP
// Q3
// for (var i=0; i <= 10; i = i++)
// {
// console.log(i);
// }
// Q4
// var userInput = +prompt("Enter a number to generate a multiplication table");
// var tablelength = +prompt("Enter table length");
// for (var i = 1; i <= tablelength; i++) {
// document.write(userInput + "x" + i + "=" + userInput * i + "<br>")
// }
//Q5