ES6 practice

by jashwant

HTML

<html>
  <head> </head>
  <body>
    <p id="example"></p>
  </body>
</html>

JavaScript

const url = 'https://jsonplaceholder.typicode.com/todos/1';

function getResponse(){

fetch(url)
.then((r) => r.json())
.then((json) => {
console.log(json)
}).catch((error) => {
console.log('failed');
});
}
getResponse();