im not sure if this is a stupid question I'm a noob in node I'm building a youtube video download app and I'm having trouble with this block of code
ytdl.getInfo(req.body.url)
.then(info => {
let title = info.videoDetails.title;
ytdl(`https://www.youtube.com/watch?v=${v_id}`, {quality: "highestvideo"})
.pipe(fs.createWriteStream(__dirname + `/videos/${title}.mp4`));
console.log(title);
I'm getting error: "ReferenceError: title is not defined" when I try to console log "title" I tried making this a global variable with global.title, but it didn't make a difference i just would like to know how to reference the variable outside the scope (sorry if duplicate post)