What does fetch() return?
A promise that resolves with a Response object
What is the default request method used by fetch()?
The GET method
How do you specify the request method (GET, POST, etc.) when calling fetch?
You can specify the request method as a value in the “method” property of the “init” parameter object, which is the second parameter passed into “fetch()”.
example:
fetch('https://example.com/profile', {
method: 'GET'
})
.then(response => response.json())
.then(data => {
console.log('Success:', data);
})
.catch((error) => {
console.error('Error:', error);
});