Skip to main content

All Questions

Tagged with
-1 votes
1 answer
134 views

Store object permanently in browser everytime the user inputs anything

let person = {}; document.getElementById('form').addEventListener('submit', function(e){ e.preventDefault(); const key = document.getElementById('key').value; const value = document....
Rishi Ghosh's user avatar
-1 votes
1 answer
312 views

Convert Array of Javascript Objects to JSON String without the ID?

i'm trying to convert a large set of data into a json file, but this conversion method adds an ID in front of the objects. I've been searching for a min and can't find another way of doing this? var ...
Amissi's user avatar
  • 197
3 votes
4 answers
1k views

Renaming keys in an object using reduce method in JS

Following is the object in which I want to replace countryID with value, countryName with label. In the same object I am having localLanguages Array in which I am trying to rename language with label ...
Nesh's user avatar
  • 2,453
2 votes
1 answer
149 views

Strangely, window.document is not returning proper object which it should ideally return. Why? [duplicate]

Case I: (Any general object) Obj1 = { name: "Jack", age: 21, address: { city: "New York", street: "Black Street", house_no: 39 } } Now, on console.log(Obj1.address) I will get: { ...
Deadpool's user avatar
  • 8,100
3 votes
6 answers
145 views

check if key exist in object javascript

I have object in which if key does not exist set to null using javascript. If the key doesnot exist in object obj like ccy does not exist cn MY and CA, how to assign and set to null using javascript. ...
Senthil's user avatar
  • 1,081
0 votes
1 answer
663 views

js file doesn't import a js module correctly, even with type="module" inserted on the html

I have a js class inside movie.js that I'd like to import to my code on main.js where I plan to work with it. I've been struggling with the following error: SyntaxError: import declarations may only ...
Carolina de Moraes's user avatar
1 vote
1 answer
105 views

Am doing the destructing right?

I have a coding challenge, which am sure am getting it right , but the challenge requires that certain steps need to be in account before moving forward. And i seem to be skipping a step which is to ...
ola owo's user avatar
  • 25
6 votes
1 answer
2k views

Are variables in script type = "module" "invisible"?

Say I have the following code: //myjs.js let testingVisibility = "hello"; <script type = "module" src = "myjs.js"></script> When I want to access testingVisibility variable ...
Richard's user avatar
  • 7,369
0 votes
1 answer
161 views

How to replace a certain number with that many X's? [duplicate]

I work at a dealership and Im moving our sales board onto a screen. We use to every time we sell something, we add a X to the board. but now I want to make it simple for my managers to use so I want ...
KennethPryor's user avatar
0 votes
2 answers
165 views

Why is the value of `this` in a dom event listener callback not the window?

Let's look at the following code: const div = document.getElementById('foo'); div.addEventListener('click', function() { console.log(this); }); <div id="foo">click me</div> ...
Andrew Kim's user avatar
  • 3,285
0 votes
4 answers
49 views

Avoid replica of code inside function (Javascript only)

I want to get the value from text box field on button click which invokes function that performs operation and store result in another text field. I have six operations - addition, subtraction, ...
harpreet's user avatar
0 votes
1 answer
39 views

Display all pupil data from object property of school class

I want to display all pupil data from 'pupils' which is an array of objects belonging to the School class. I have created a new instance of the school class and a forEach loop which takes each pupil ...
Gerard Way's user avatar
2 votes
1 answer
669 views

Removing an array item with splice if the value(s) is(are) true

I am trying to remove checked items that are true from an array with the array.splice method. It seems to work most of the time, but for some reason, there are times when two or three items are ...
JackJack's user avatar
  • 193
1 vote
2 answers
16k views

Video error - Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause()

I have recently purchased a video script with a built-in ads system. Seems to work pretty good. I can dynamically add various types of ads, etc. There is an issue, however, with it playing one of my ...
completeidiothereDoh's user avatar
1 vote
1 answer
2k views

javascript auto call function in object

I need to create a dynamic object. I'll store all of these objects in an array. Each object will have some property and objects. After the object is created, I need to do an auto execute method from ...
Radu Theodor's user avatar