All Questions
Tagged with parameters javascript
2,020 questions
0
votes
1
answer
36
views
How to use javascript variables in URL as querystring parameters [duplicate]
I want to use javascript variables in URL as querystring parameters. what is correct way?
var fromSemester = document.getElementById('<%= newFromSemesterValue.ClientID%>').value;
var ...
-2
votes
0
answers
22
views
Why is the browser not including the full URL parameter [duplicate]
When the request is made to the aws endpoint, why is it cutting off some of the url paramerter ?text=?
<div class="container">
<h1>Search Engine</h1>
<div class=&...
0
votes
1
answer
36
views
JS redirect from [example.com/home] to [example.com/home?loc=USA] causes infinite loop
I'm trying to redirect from example.com/home to example.com/home?loc=USA.
But it causes infinite loop. How do I stop it? Thanks.
My code:
<script>
window.location = "example.com/home?...
-1
votes
1
answer
66
views
How to select URL parameter and exclude all the other stuff that comes after it?
I'm using dynamic text based on a URL parameter. Basically, the goal is to select the first word in the URL parameter and insert it into a paragraph. However, in my current code, it selects the first ...
-1
votes
2
answers
54
views
Why is my JavaScript is returning NaN when I run the code? [duplicate]
I started learning programming a little while ago, but I got stuck on the functions and intervals part.
What I wanted was a very simple system, to do multiplication, using HTML and JavaScript, passing ...
0
votes
1
answer
48
views
How can solve "Type '{}' is not assignable to type 'string'" problem
this my index.tsx file:
import React from "react";
import UserInput from "./userInput";
import {
View,
StatusBar,
} from 'react-native';
const App = ( ) => {
return (
...
0
votes
0
answers
66
views
`useSearchParams` requires `Suspense` boundary, despite not exporting module
this is my current usage of useSearchParams:
let rawValue = useSearchParams().get("val");
let val = 0.001;
if (rawValue) {
val = parseFloat(rawValue);
}
This is my only usage of ...
0
votes
0
answers
29
views
Execute array of callbacks with parameters [duplicate]
I'm trying to store callbacks that specify parameters in an array and then execute them sequentially but I don't really understand how to achieve this in JS.
What I want to do:
var callbacks = [
...
0
votes
1
answer
24
views
Javascript: store number from custom div parameter in input [duplicate]
at
Icarus-manifest.de
I use a calender widget, which needs to be customized, but I´m in some challenges and hope someone can help me.
At the right side of the widgets bookable slots are shown.
The ...
-1
votes
1
answer
64
views
Question about returns statements and function parameters
I'm new to software and there is this piece of code which is a solution to an array exercise but I don't understand why it works. First of all the first thing it does is to return the string you enter ...
0
votes
2
answers
195
views
How do default values of Class fields work in JavaScript
I saw this piece of code in MDN while I was learning some syntax about Class in JavaScript today, which really confused me. Here it is:
class Rectangle {
height = 0;
width;
constructor(height, ...
0
votes
0
answers
18
views
Javascript: Change a function parameter that has a default value without having to change the preceding ones [duplicate]
How to modify a default parameter in a javascript function, knowing that the previous parameters must remain default?
function f(a = 'a', b='b', c='c') {
return [a, b, c];
}
f( c ='some value here')...
0
votes
0
answers
24
views
function with parameters not working with onclick and work with console.log only [duplicate]
here is the code
<button id="show">Show</button>
<script>
function sayMessage (fName, lName) {
let message = `Hello`;
function concatMsg() {
message = `${message} ${...
1
vote
1
answer
2k
views
How can I fetch additional data after the page is already rendered with remix?
I'm using a loader to fetch the ids of several resources and the user can select the ids of the ones they would like to load.
I haven't found a way to pass new arguments to the loader to GET new data ...
1
vote
1
answer
2k
views
Next.js params undefined [duplicate]
I am trying to get the endpoint from a page in my Next.js application using the url parameters, but it keeps coming back undefined even though I can see the endpoint in the browser.
I have tried using ...
0
votes
1
answer
78
views
Null is popping up when it shouldn't be
New JavaScript coder here, self taught. Learning for fun and very confused along the way.
Anyway when I check my code on the browser, "null" comes up for "computerSelection". Here ...
0
votes
0
answers
22
views
how to get params from inline javascript [duplicate]
is there a way to get query params like below , in this case is appId
<script async src="mydomain.com/sdk.js?appId=587970469219817"></script>
and use the params inside sdk.js ...
0
votes
0
answers
63
views
What is the best way to pass an object by reference in JavaScript without modifying it
I studied that Javascript passes objects by 'pass by reference' to functions. When those objects are mutated/updated inside a function, then it affects the original object. This is clear!
let obj = {
...
-1
votes
1
answer
124
views
How to set key_ops in generating JWK using java script?
I want to generate JWK with parameters using JavaScript. Following is the code I used to generate JWK
var JA = java.util;
var JWKgen = Packages.com.nimbusds.jose.jwk.gen;
var Keys = Packages.com....
0
votes
1
answer
53
views
Passing / calling a JS method by its name
I have to rewrite (a simpler version of) the ‘invoke’ method from the Underscore library for an assignment, which accepts a method’s name as a parameter. So far all I’ve found is that the () should be ...
0
votes
2
answers
52
views
Javascript add parameter if "ccm_order_by_direction=desc" is in the URL
I am trying to find a way to add &#filterTop to the end of the URL if ccm_order_by_direction=desc is in the URL.
I assume JavaScript would be the easiest, but if there is a PHP way that would ...
0
votes
2
answers
60
views
Can we change the parameter of a function later on after defining it once?
function convertToFahrenheit(celsius) {
return (celsius * 9 / 5) + 32;
}
function convertToCelsius(fahrenheit) {
return (fahrenheit - 32) * 5 / 9;
}
function convertTemperature(...
0
votes
1
answer
46
views
How can I declare parameters for callback function via summary?
So I want to add a callback function to my other function, but the issue is since I want this code to be public, I want people to know what parameters to enter and what their types are.
I've tried to ...
0
votes
1
answer
99
views
How to set a default parameter value if no argument is passed through using the switch statement condition?
I'm doing a lab exercise on VScode for an assignment and I'm unable to pass one of the Mocha test requirements. This test requires "takes in two arguments, a name and a language, and language ...
0
votes
1
answer
81
views
Modifying a parent class's constructor parameters and passing them to `super()`
I have a base class, Sprite, and a subclass Player. Sprite's constructor() takes a few parameters, one of which is the path to an image. Player should take all parameters except the image path, and ...
1
vote
2
answers
106
views
How to get a value from the InnerHTML through a event Listener if you click on or select it
I am Trying to get a value from a Event Listener , I am creating a Game cards it will do comparative among numbers , whatever I select it will take ta value and Run Function it will compare Value ...
0
votes
1
answer
149
views
How to send a number in query string with axios
My react application call an API to post with query string.
For example,
var param = {
name: 'Alex',
age: 22
}
axios({
baseURL: 'https://aaa.com',
url: '/user/create',
method: 'post'...
-1
votes
1
answer
62
views
How can I change the position element via jQuery plugin on mousemove?
I need to change the position element via jQuery plugin on mousemove. I'm getting the mousemove coordinates in the index.js file and trying to pass it as params to jQuery custom plugin. So the indexjs ...
0
votes
0
answers
44
views
javascript assign function with parameter to a variable [duplicate]
I am working on a project developed in php and javascript.
I need to define a variable that contains a function and its parameters and call it only when a specific button is clicked.
class Project {
...
0
votes
1
answer
60
views
() => count + 2 vs. (count) => count + 2
function Counter() {
const [count, setCount] = useState(0);
const [calculation, setCalculation] = useState(0);
useEffect(() => {
setCalculation(() => count * 2);
}, [count]); // <...
0
votes
1
answer
37
views
Move onchange(this) from HTML to JavaScript, missing parameter but code breaks when I include it
I am trying to write a website for an imaginary ice cream shop in order to practice JavaScript.
function hideAAndB() {
var pickupDiv = document.getElementById("pickupDiv");
var deliveryDiv = ...
0
votes
1
answer
38
views
Problems with params with routing in NodeJS
I'm using routing in NodeJS and I'm trying with routers in other routers, let's see:
server.js:
const routerProyecto = require('./routes/proyecto').routerProyecto;
app.use('/api/auth',routerAuth);
app....
1
vote
1
answer
30
views
App Crash - React Redux - not getting params correctly
I'm currently facing an issue with deleting items from a wishlist in my React Redux application. I have implemented a feature where users can add items to their wishlist, but when they try to delete ...
1
vote
0
answers
67
views
How can I define multiple names for a parameter in JavaScript?
In Chrome DevTools' Console, you can see that some function parameters have multiple different names.
This is an intuitive and simple signifier that a parameter accepts multiple different types of ...
0
votes
2
answers
30
views
How can I pass parameters in jquery to a on click function of a button dinamically created?
long time lurker here in need of help.
I have a class named button
class GameButton
{
constructor ( id, width, height, buttonFunction, attrs )
{
this._id = id
this....
1
vote
0
answers
208
views
Get values from repeated parameter in query string accessing 'parameters' in sourceMap
I'm facing a newbie to Mirth and I'm struggling against an easy problem I think, but I cannot find the solution.
I'm using mirth v3.12.0 and I set an http listener channel that received a GET request ...
0
votes
1
answer
1k
views
Cannot read properties of undefined (reading 'size') - Next js 13
Today, i come up with one problem that i'm using Next js 13.4 version with backend. so when i used searchParams in server side, it was throwing error: Cannot read properties of undefined (reading '...
-2
votes
1
answer
224
views
change colors with function parameters
I am trying to change colors using a function and its parameters with template string, can't figure out the correct way of doing it. Can somebody help?
function colorize(choice,color){
choice....
0
votes
1
answer
50
views
How do I set the parameter for the passed function in typescript using generics?
In below code in function resHandler(), res is type any. But I passed the type when calling sendRequest(). Shouldn't res is of type 'PersonType' automatically?
type PersonType = {
name: string;
...
0
votes
2
answers
312
views
Python-like function parameters in JavaScript [duplicate]
I'm trying to emulate the functionality of random.choices in the Python standard library, in JavaScript. I tried this code:
function choices(arr, weights = null, k = 1) {
let out = [];
if (...
-1
votes
1
answer
78
views
Struggling with URL Parameters
I need an advice regarding URL parameters. Sometimes when I click a button which switches the page from page 1 to page 2, it removes some GET parameters values.
Here is an example for an <a> tag:...
0
votes
0
answers
14
views
How do I utilize PSQL parameter binding in JavaScript?
DELETE FROM table WHERE id IN ($1), [[2,5,7,101]];
I've also tried:
DELETE FROM table WHERE id IN ($1), ([2,5,7,101]);
But I get this syntax error:
Query 1 ERROR: ERROR: syntax error at or near &...
0
votes
1
answer
702
views
Pass an ASYNC JavaScript function as parameter [closed]
I am trying to pass an async JS function as a function parameter, but I keep getting an undefined response. I found code in another SO answer which works when not using async/await, but when I tried ...
0
votes
0
answers
34
views
Problem with parameters in a function inside a interval in JS
I'm making a Chronometer and i don't understand why when i use a function with parameters it doesn't work but when I write the entire function code replacing the values, it works perfectly, I'm using ...
0
votes
1
answer
231
views
Must parameter passing into dispatch function be Object which containt 'type' property in reactjs
i am learning about useReducer in Reactjs. In teaching video or documentation about useReducer Hook, parameter passed into dispatch function is always a regular JavaScript object (which contain type ...
0
votes
2
answers
37
views
How to call an importe function javascript and vuejs?
I'm expecting to call the function that is previously imported. But I see no result.
<script>
import { search } from '../modules/api/drafts'
...
methods: {
draftSearched (payload, search ...
0
votes
0
answers
51
views
Object reference as parameter, javascript [duplicate]
I have a function that takes the full-path(a.b.c) to a field in an object and deletes it, i pass the object as a parameter, part of the function is reassigning the object parameter which is a ...
0
votes
0
answers
20
views
How does parameter of closure pass down to inner function? [duplicate]
recently , I'm learning coding , and here's the code of teaching closure
function accumulator(){
let sum =0;
return (num) =>{
sum = sum + num;
return sum;
}
}
const acc ...
-1
votes
1
answer
49
views
node not showings single details in postman with params
In my react project i need fetch single details to details page with params but the response not sending to postman.after sending request the response not coming in postman
index.js
import express ...
-1
votes
1
answer
181
views
How on earth are these Functions supposed to be written? There was no example for this specific type. They're mostly arguments
This is a part of a course that did not elaborate
introduction(name)
1) takes in an argument of a name and returns a phrase with that name using string interpolation
introductionWithLanguage(name, ...