Can you please explain what const { hostname } = a; does and how?
const { hostname } = a;
That's called destructuring assignment. "a" probably is an object which has the hostname property so that assignment extracts hostname. I'm just writin about this 😅. Hopefully that'll help you.
It has the same effect as: const hostname = a.hostname
const hostname = a.hostname
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.
re: Daily Challenge #89 - Extract domain name from URL VIEW POST
TOP OF THREAD FULL DISCUSSIONCan you please explain what
const { hostname } = a;
does and how?
That's called destructuring assignment. "a" probably is an object which has the hostname property so that assignment extracts hostname.
I'm just writin about this 😅. Hopefully that'll help you.
It has the same effect as:
const hostname = a.hostname