-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop.js
More file actions
277 lines (216 loc) · 5.16 KB
/
oop.js
File metadata and controls
277 lines (216 loc) · 5.16 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
// function multiFunction (a,b ){
// return a * b;
// }
'''
// let num1 = 5;
// let num2 = 10;
// let multiplication =multiFunction(num1 , num2);
// console.log("multiplication of two number:", multiplication)
// function subtractFunction (a, b){
// return a-b;
// }
// let num1 = 50;
// let num2 = 40;
// let subtract = subtractFunction(num1 ,num2)
// console.log("Subtration of two number will be :", subtract)
// let addition = (a,b) => a+b;
// let num1 =25;
// let num2 =25;
// let sum = addition(num1,num2);
// console.log("Addition of two number will be :",sum)
// let subtraction = (a,b) => a-b;
// let num1=80;
// let num2=40;
// let sub= subtraction(num1,num2);
// console.log("subtraction of two number is", sub)
// addition of two number using operator
// let num1=10;
// let num2=20;
// num1 += num2;
// console.log("result of two number is: ", num1)
// let num = -3333;
// if(num>0)
// console.log("This number is positive")
// else
// console.log("this number is negative")
// let addition = (a , b) =>a+b;
// let num1=33;
// let num2=33;
// let sum=addition(num1,num2);
// console.log("addition of two number :" , sum)
// class human{
// name="Vikas";
// lastname="kumar";
// age=21;
// task=function(){
// console.log("teaching");
// }
// }
// let human1=new human();
// console.log(human1);
// class Human{
// nooflegs;
// noofhands;
// noofeyes;
// constructor(legs,hands,eyes){
// this.nooflegs=legs;
// this.noofhands=hands;
// this.noofeyes=eyes;
// }
// }
// let human1 =new Human("2","2","2");
// console.log(human1);
// class Animal extends Human{
// }
// let animal1=new Animal("2","4","3");
// console.log(animal1);
// class Creature extends Human{
// }
// let Creature1= new Creature("4","5","5");
// console.log(Creature1)
// // class Animal{
// nooflegs;
// noofhands;
// noofeyes;
// constructor(legs,hands,eyes){
// this.nooflegs=legs;
// this.noofhands=hands;
// this.noofeyes=eyes;
// }
// }
// let animal1 =new Animal ("2","3","4");
// console.log(animal1);
// const fetchData=async()=>{
// const data= await fetch("https://www.youtube.com/");
// console.log(data);
// }
// console.log(2);
// let rows = 10;
// let pattern = "";
// for(let i=1; i<=rows; i++){
// for(let j=1;j<=i; j++ ){
// pattern+=j;
// }
// pattern+="\n";
// }
// console.log(pattern);
// let rows=5;
// for(let i=0;i<5;i++){
// for(let j=0;j<=i;j++){
// console.log("4");
// }
// const inputBtn = document.getElementById("input-btn");
// const addBtn = document.getElementById("input-btn");
// const list = document.getElementById("input-btn");
// const ct =document.getElementById("count");
// let count=0;
// function addItemToTheList(){
// const text =inputBtn.value;
// if(text.length===0){
// alert("please enter something greater than lenght 3");
// return;
// }
// const lis=document.createElement("li");
// lis.textContent=text;
// list.appendChild(lis);
// inputBtn.value="";
// }
// addBtn.addEventListener("click",addItemToTheList);
// function changecolour(newcolor){
// const elem.getElementById("Change-txt");
//
// function changeColor(newColor){
// const elem = document.getElementById("Change-txt");
// elem.style.color =newColor;
// }
// debugger
// const username="vikas";
// var age="21";
// const address="delhi";
// console.log(username);
// console.log(username,age,address);
// function aaaasayMyName(){
// console.log("Hello vikas");
// aaaasayMyAge();
// }
// function aaaasayMyAge(){
// console.log("I am 21");
// }
// const fun= ()=>{
// console.log("The dicee academy");
// }
// fun();
// var fun = () => {
// console.log("I am fat aarow fun");
// };
// undefined();
//Ques 1 = upper left tringle pattern
// let n = 5;
// for (let i = 1; i <= n; i++) {
// let str = "*";
// console.log(str.repeat(i));
// }
//output
// *
// **
// ***
// ****
// *****
// .Ques 2 = Upper right tringle
// let n = 5;
// for (let i = 1; i <= n; i++) {
// let str = "*";
// let space = " ";
// console.log(space.repeat(n - i) + str.repeat(i));
// }
// Output
// *
// **
// ***
// ****
// *****
// Object literals
// const circle = {
// radius: 1,
// location: {
// x: 1,
// y: 1,
// },
// draw: function () {
// console.log("draw");
// },
// };
// Factory Functions
// function createCircle(radius){
// return{
// radius,
// draw: function() {
// console.log('draw');
// }
// };
// }
// const circle= createCircle(1);
// ************** Patterns *****************
// TRIANGLE PATTERN-1
// let rows = 5;
// let pattern = "";
// for (let n = 1; n<= rows; n++) {
// for (let num = 1; num <= n; num++) {
// pattern += num;
// }
// pattern += "\n";
// }
// console.log(pattern);
// vikas = {
// name: "vikas kumar",
// favNum: 5,
// developer: true,
// };
const URL = "https://cat-fact.herokuapp.com/facts";
const getFacts = async () => {
console.log("getting data .....");
let response = await fetch(URL);
console.log(response); //JSON Format
let data = await response.json();
console.log(data[0].text);
};