Hello my problem is about function inside '.then' function. Why my standart function isn't working ? But when arrow function works. What is main difference between arrow function and standart function
fetch('cart/',{
method:'post',
headers:{'Content-Type':'application/json'},
body : JSON.stringify({'something':'something' })
})
.then( res=> res.json())
.then(data => console.log(data));
Above code works .Also this is my approach
fetch('cart/',{
method:'post',
headers:{'Content-Type':'application/json'},
body : JSON.stringify({slug: g})
})
.then( function (res){ res.json() )
.then(function (res) { console.log(res) });