I really don't why I am getting undefined while my jquery code seems to be perfect
const request = require('request');
const cheerio = require('cheerio');
const fs = require('fs');
request('https://www.goodreads.com/quotes/tag/entrepreneurship?page=1', function (error, response, body) {
const $ = cheerio.load(body);
let data = [];
$('.quoteText').map((i,elm) => {
console.log(elm.innerText) //undefined
})
});
Not working
what doesn't work?
âžś css-select-test git:(master) âś— node
const request = require('request');
undefined
const cheerio = require('cheerio');
undefined
const fs = require('fs');
undefinedrequest('https://www.goodreads.com/quotes/tag/entrepreneurship?page=1', function (error, response, body) {
...
... const $ = cheerio.load(body);
...
... let data = [];
...
... $('.quoteText').map((i,elm) => {
... console.log($(elm).text())
... })
... });“If you want to build a ship, don’t drum up the men to gather wood, divide the work, and give orders. Instead, teach them to yearn for the vast and endless sea.” ― Antoine de Saint-Exupéry
“Rejection is an opportunity for your selection.”
―
Bernard Branson
.....
Most helpful comment
Not working