7,178 questions
-6
votes
1
answer
161
views
How should I efficiently add all pairs in a key-value array to an object?
I have an object obj; and I then obtain an array arr of key-value pairs. Assuming that the key sets of obj and of arr are disjoint (i.e. no key appears in both) - how do I efficiently add all pairs in ...
1
vote
1
answer
70
views
Google Maps Custom Style Not Applying in WordPress (Elementor)
I’m working on a WordPress website using the Elementor Pro page builder, and I’m trying to integrate a custom-styled Google Map on the "Contact Us" page.
What I’ve done so far:
Created a ...
0
votes
0
answers
132
views
Issue with Injecting Text into WhatsApp Web Input via JavaScript Extension
I'm working on a JavaScript extension for WhatsApp Web, and I'm facing a problem I can't seem to solve. The goal of my extension is to correct and manipulate the text in the message input of WhatsApp ...
0
votes
0
answers
27
views
Storing an object key/value in an array but not in an array element [duplicate]
I found some odd things and am looking for explanations as to how and why
let a = [] ;
a.push({foo:"bar",bar:"foo"}] ;
console.log(a) ;
As expected, prints out:
[[object Object] {
...
-1
votes
1
answer
67
views
Question about Javascript: Can I assign two names to the same member? [closed]
I have a set of objects, that contain references to other objects. There is always a general reference: nextObject. But sometimes, I know more about the object beside me. So I could use a member ...
-5
votes
1
answer
112
views
Javascript cannot map object with repetative values
I need to style specific elements by id using given object.
Keys and values in projectSkillsMap object corresponds to ids in html file. When user clicks on element with id listed in object keys ...
0
votes
1
answer
72
views
How to retrieve the name of an Object passed as a Key to a Map?
I'm a newbie to Javascript. I wish to know how to get the key as 'personObj', 'carObj, 'workDetailsObj', 'displayFunction' and 'primitiveValue' and print those values in console? Also, how to print ...
5
votes
1
answer
270
views
What is a restricted JavaScript object?
I'm trying to use custom DOM events to communicate between the main world and the isolated world for a page in a webextension in Firefox. When trying to access an event object property, I get an ...
0
votes
0
answers
106
views
Why does the GeoJSON format expect coordinates in an array rather than an object with keys?
Take the following example from their home page:
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]...
0
votes
0
answers
66
views
display button into html form failed with initialize
My script doesn’t work well.
When the button “b5” clicked with ouside <form ...> ... element, the buttons b5 and b4 deseapper and the buttons b1,b2,b3 appear. This work normaly when my code ...
-1
votes
1
answer
131
views
JS manipulates the DOM, then CSS doesn't load properly on refresh, even though cache is disabled [closed]
PROBLEM
Hi, I have some JS that manipulates the DOM to show / hide certain elements when needed. It works perfectly when the event handler is fired (click event). The problem is that when I refresh ...
1
vote
0
answers
36
views
How to retain scrollbar position even after reloading using javascript
After clicking on any lower check box in the grid the vertical scrollbar position changed to top level in the grid. How to keep the vertical scrollbar in same position after reloading the grid.?
after ...
0
votes
0
answers
14
views
Google Sheet - Image as button
I would like to use an image as a button for me to go to another cell in the same sheet. Happy if I can get someone to share the appropriate scripts. Thanks
I have tried a button to go to another ...
0
votes
0
answers
37
views
how to click cq-toggle element dynamically using javascript
how to click cq-toggle element dynamically using javascript?
When i click manually on cq-toggle menu item it actually adds active class to the element cq-toggle and add one div content in document ...
0
votes
2
answers
83
views
Add up JSON strings to one variable | JavaScript [duplicate]
I have been trying to figure out how to merge several JSON strings into one.
My method is this:
if (observations[31]) { // Ignore this.
document.getElementById("ajaxrainmo").textContent = ...
1
vote
0
answers
276
views
document.querySelector() returns null for an existing element
I have issues selecting certain elements on a specific web page, querySelector returns null unless I first go through one of the parent element.
I tried chaining them together but still I eventually ...
-2
votes
1
answer
24
views
How to extract and insert json data in a key and value format
I have this data and would like to extract the Title data only and insert it as a id and value.
const dataSource = [
{
id: '1',
Title: 'My World',
Price: 10,
},
{
id: '2',
Title: 'My Home',
Price: 20,
...
0
votes
1
answer
59
views
Why is the below piece of code giving error when I add console log line and working fine if I remove it?
The code below works fine if I remove the console log line but not with it
function gcd(a, b) {
while (b !== 0) {
console.log(a,b)
[a, b] = [b, a % b];
}
return a;
}
...
0
votes
1
answer
63
views
How do I access dynamically created objects and their properties in JavaScript?
If I write a function that creates a new person and attach it to an onClick event on a button, how can I access the data that was entered without a variable name?
When a user presses the button, the ...
1
vote
0
answers
27
views
Why does the name of a property change what access method works?
I have an object named facility
facility = {
facility_id: 495867,
facility_name: "4 Pig farms Brookvale",
registered_business_name: "BROOKVALE FARMS COMPANY PTY LTD",
...
0
votes
1
answer
73
views
Inserting Javascript array elements into another array with ternary operator
I have an array of objects where each object defines a field in a React form. I want to display different sequence of fields depending on a boolean state. This means that I need to insert either one ...
-1
votes
1
answer
41
views
Add Object name and Variable Name using Javascript [duplicate]
I Have A Object Called res and i have a variable Called lea
need to concatenate
for example
let lea = "abc";
let res = {
abc:'steve'
};
console.log(res.lea);
So My Output Should Be steve
I ...
0
votes
1
answer
203
views
Office script to get data from table, filtered data and pasted into a new tab and new table
I have been trying to extract filtered data from my "PMs" table in my excel, I need to filter column D for statuses that are equal to "WSCH" or "WAPPR" or "INPRG&...
1
vote
1
answer
40
views
Object array type property is undefined in different file
I am in the process of refactoring a js file in which I used the THREE.js library to draw a truck visualization based on the parameters provided in the form. The code worked, but I need to extend it ...
0
votes
2
answers
97
views
How-to extract Object out of a Function?
Is it possible to extract an Object out of a Function with JavaScript?
The function I received inside of an Object:
function item(){ let product = { name: name, price: price } }
I want to extract the ...