this is my html file
<script>
var output = console.dir(location);
document.write(output);
</script>
and iam trying to assign console output to a variable "output"
but its output is just
undefined
what i need is somewhat like,
{
"ancestorOrigins": {
"0": "https://www.google.com"
},
"href": "about:blank",
"origin": "null",
"protocol": "about:",
"host": "",
"hostname": "",
"port": "",
"pathname": "blank",
"search": "",
"hash": ""
}
output would be a json or array
but it wouldn't be undefined
or do i have to use try & catch or something like that to get its output