this used to be my code in older carto.js
cartodb.SQL({user: 'user'}).execute(sqlquery).done(function (data){
console.log(data);
}
how to readapt it in newer cartojs 4.0 beta
You can use any HTTP client like axios (example here) or just use the Fetch API if you are OK on the browsers that support it nowadays.