Skip to main content

All Questions

-3 votes
2 answers
89 views

Can you assign an element's class list to a variable by clicking on the element?

The main question I have is: Is there a way to assign to a variable an element's class list by clicking on said element without directly referencing the element in the JavaScript. Expanding on this, I'...
ScalarQuantity's user avatar
1 vote
1 answer
52 views

Sheets - Use a form to add data, but to a worksheet name based on the data input

As the title explains, I have created a workbook in Google Sheets. There is a worksheet labeled "Form" which be used to input data into one of 12 worksheets (the months of the year labelled ...
Chazwod's user avatar
  • 13
0 votes
2 answers
136 views

Why can I redeclare a variable of the same name as a function parameter within an if statement?

Below is a trivialized version of a solution I came across while trying to implement a version of the Jquery CSS function. function CSS(prop, value) { ... if (value === undefined) { ...
GHOST-34's user avatar
  • 378
0 votes
1 answer
32 views

New values of outside variables from "click" event do not persist on the first attempt

I'm working on a to-do project where one can click a button to add a new to-do, or click on an existing card to edit that to-do. I decided to have both use the same form, but with a different "...
user23995517's user avatar
0 votes
1 answer
72 views

How to make this input form-validation check right? [duplicate]

I've got assignment to make this form in js/jquery. The code looks good on error side of things (coloring red forms and throwing errors) but it should color the input form in green for correct ...
Central-Attack's user avatar
0 votes
1 answer
78 views

JavaScript addEventListener calls function but fails to update global variable

Bear with me, as I am a novice. I'm coding in JavaScript and using an .addEventListener on document.getElementById("texts") to track changes in an HTML dropdown. The .addEventListener calls ...
ivanheyman's user avatar
-1 votes
1 answer
68 views

dollar sign $ as an assignment operator for a value of string in vs code ( js ) does not work or highlighted [closed]

function sayHello (userName) { console.log ('Hello ${userName}') ; } sayHello ('Mena') ; function sayHello (userName) { console.log ('Hello ${userName}') ; } sayHello ('mena') ; // i ...
Mena Makrem's user avatar
2 votes
1 answer
58 views

Difference between assignment and unpacking intto one array to another

I have this code in JavaScript what is the difference between the lines A and B ? const arr1 = [1,2,3,4,5] const arr2 = [...arr1]; // Line A const arr2 = arr1; // Line B I want to know is it ...
Srajal Dwivedi's user avatar
0 votes
0 answers
28 views

Strange assignment in Javascript [duplicate]

Good morning, I've encountered a strange behavior of assignments in javascript. The behavior is replicable outside the specific project, here's how to trigger it: function A_n(){ var u=100; ...
Giafar the mistery dev's user avatar
2 votes
0 answers
57 views

Why does assignment of an array value behave differently when the index is modified in the right? [duplicate]

I noticed that there are two different behaviors in the assignment of an array value, like arr[i] = ++i. In C++ int arr[] = {0,0}; int i = 0; arr[i] = ++i; cout << arr[0] << ',' << ...
Yucheng Zhou's user avatar
0 votes
1 answer
320 views

Identifier * has already been declared, script is an external script

I am in the process of creating an embed for instagram posts. However when using the script: https://www.instagram.com/embed.js I get the following errors in the browser: Localhost Environment: ...
StylisX's user avatar
  • 11
0 votes
2 answers
40 views

How can i link a specific array item from one list, to a corresponding array item from a different array list?

So i am creating a Star Wars inspired random quote generator on vscode which gives a random quote and also gives a real life scenario in which it could be used (advice), but i have encountered an ...
StoreyCoding7's user avatar
1 vote
2 answers
103 views

Expressions in my template literal don't get updated

I define the variable description as a template literal with an expression in it. When I then use description later in runScenario, the expression returns what money started as, not what it currently ...
pyradim's user avatar
  • 15
-2 votes
1 answer
25 views

Why is the variable not defined?

I keep getting this error message: plate is not defined. How do I fix this? And can I pls get an explanation why it doesn't work? Sorry if this is really bad, it's my first time on stackoverflow. ...
I need help...'s user avatar
0 votes
0 answers
261 views

Assign data returned from api to variable + javascript [duplicate]

I am working with an api in javascript to return some healthcare data to be analyzed and visualized. I created a function get_data() to access the data so it can be used elsewhere in the script: ...
John Conor's user avatar

15 30 50 per page
1
2 3 4 5
25