All Questions
Tagged with global javascript
585
questions
0
votes
0
answers
24
views
How can i list root objects JavaScript [duplicate]
So I have several objects and classes in my script tag
const Main = {}
const App = {}
class Game {}
let state = 777
etc. I'd like to list them.
I've tried
Object.keys(Object.getOwnPropertyDescriptors(...
-1
votes
1
answer
74
views
var vs let for *globals*... what practical difference does "a property on the global object" make?
I have seen this (or similar):
At the top level, let, unlike var, does not create a property on the
global object.
many times.
My question is: what practical difference does this make ?
Or, to put ...
0
votes
0
answers
39
views
Add persistent global function across pages via window, or localstorage, etc
I am trying to hide an icon on a page I can't edit directly. I need to add a function that has in it document.getElementById('icon').style.display = 'none';. I don't need help with the function.
So ...
1
vote
0
answers
36
views
Using a varibale outside of the event listener block
I have been having difficulty accessing the variables populated within an eventlistener which is used to obtain the results from a php query. I tried a number of different ideas but I have been ...
0
votes
0
answers
74
views
Unexpected global objects in node 18 [duplicate]
When executing with node v18.17.1, why are there different versions of the global object?
function foobar() { return this; }
console.log(this); // {}
console.log(foobar()); // Large output, as below:
...
0
votes
0
answers
83
views
Global vs. local scope at `(new Function()).call(...)`
my Problem seems to be in my module.js.
It seems the evaluateJavaScript() function calls my script modules correctly:
the this in the module is a reference to the new Module() object (within Module....
0
votes
0
answers
28
views
How do i put a variable from one javascript function to display via another javascript function on an html site [duplicate]
Im trying to make it so that when i click 'submit', my data gets stored in variables and then when i click 'show' the data gets displayed
this is my js code:
var Usrname = "";
var Passwrd = &...
0
votes
0
answers
19
views
Unable to use global variable with createElement inside loop [duplicate]
I am unable to create a global variable for a document.createElement('br') object and reuse it inside loops. In the example, I show where can:
Example 0: Call document.createElement('br') each time ...
-1
votes
1
answer
41
views
How can I delete an object and capture the deletion of the object event?
There are two things I am trying to do:
delete an object whether a const or let - right way to do it in node.js
capture the delete or assignation of null or undefined to cInst or dInst object in the ...
0
votes
0
answers
144
views
How can I make the bowser library globally available on a web page?
I'm working on a SPA where under some condition I have to log some browser and operating system data. So I loaded the script for the bowser library - when the condition is met - but unfortunately I ...
0
votes
1
answer
73
views
Continuing code after an unhandledrejection event
https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event
The unhandledrejection event is sent to the global scope of a
script when a JavaScript Promise that has no rejection ...
2
votes
1
answer
147
views
`this` keyword is undefined in NodeJS [duplicate]
I am having trouble understanding "this" keyword behaviors in JavaScript (NodeJS - v16.19.1). According to this site, "this" keyword in the global execution context will reference ...
1
vote
1
answer
212
views
Script Scope in JS
I was going through Lexical environment and environment record / scope in JS.
I know difference (partly) between var and let (one being block scoped, while one being functional scope) and also the let ...
0
votes
0
answers
180
views
Tampermonkey add global functions available in console
My problem was: I could only call the function for the first time when I press Ctrl Shift I to call out the console. After that, the function won't work.
I faced this problem a few months ago and got ...
0
votes
1
answer
828
views
How to edit and pass a global variable onto several pages in Sveltekit?
On the landing page, a user will enter a dog breed they're looking for. After this is submitted, that value will be saved globally and the name of that breed will be passed into the new route. I tried ...