I am learning how to use fetch api in javascript. I tried running the following script in my localhost. However, there was nothing logged to the console. Also there was no error displayed regarding this. Many posts say that CORS might be the issue here. Can you please give an example to resolve this? Please advise.
fetch('https://jsonplaceholder.typicode.com/posts/1')
.then(response => response.json())
.then(json => console.log(json));
Please comment if you require more information.