-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
42 lines (33 loc) · 985 Bytes
/
script.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
32
33
34
35
36
37
38
39
40
41
42
//Task1
let obj1 = {name: "person1", age: 5};
let obj2 = {age: 5, name: "person1"};
if (obj1 === obj2) {
console.log("Objects are not equal.");
} else
{
console.log("Objects are equal.");
}
//task 2
var request = new XMLHttpRequest();
request.open ("GET", "https://restcountries.com/v3.1/all", true);
request.send();
request.onload=function(){
var data = request.response;
var result= JSON.parse(data);
for (var i = 0; i < result.length; i++)
{
console.log(result[i].flags.svg);
}
}
//task 3
var request = new XMLHttpRequest();
request.open ("GET", "https://restcountries.com/v3.1/all", true);
request.send();
request.onload=function(){
var data = request.response;
var result = JSON.parse(data);
for(var i=0;i< result.length;i++)
{
console.log ("counrtyname:"+" "+result[i].name.common,"Region:"+" "+result[i].region,"Subregion:"+" "+result[i].subregion,"Population:"+" "+result[i].population)
}
}