Пытаюсь оптимизировать свою работу
function checkData () {
//var data1
return axios.get('https://news.ycombinator.com/item?id=15414760')
.then((res) => {
var $ = cheerio.load(res.data)
//data1 = $('#hnmain > tbody > tr:nth-child(3) > td > table.comment-tree > tbody').html()
return $('#hnmain > tbody > tr:nth-child(3) > td > table.comment-tree > tbody').html();
});
}
checkData()
.then((data1) => {
console.log(data1);
});