I am working on web scrapping and I came across one scenario where I am get confused about arrow key function,I am unable to understand why url is used twice and how it is actual working, I know it is advanced javascript but I need some explanation to understand this completely.
first Url in arrow function:
const fethHtml = async url => { Second url pass in axios.get
await axios.get(url); const fethHtml = async url => {
const axios = require("axios").default; const fethHtml = async url => { try { const { data } = await axios.get(url); return data; } catch { console.error( `ERROR: An error occurred while trying to fetch the URL: ${url}` ); } }; My question is what url is indicating here is it variable or function and why it is called twice, I didn't found any explanation anywhere.
async url => {creates a variable to be used inside thefetchHtmlz function, whereasaxios.get(url)` passes that variable into theaxios.getfunction. This is not unusual.