1 function getvals(){
2 return fetch('https://jsonplaceholder.typicode.com/posts',
3 {
4 method: "GET",
5 headers: {
6 'Accept': 'application/json',
7 'Content-Type': 'application/json',
8 },
9 })
10 .then((response) => response.json())
11 .then((responseData) => {
12 console.log(responseData);
13 return responseData;
14 })
15 .catch(error => console.warn(error));
16 }
17
18 getvals().then(response => console.log(response));