Category "javascript"

TypeError: func.apply is not a function

I'm trying to use useEffect function like that: const [data, setData] = useState({ courses: [] }); useEffect(async () => { const result

React Router v5: history.push() changes the address bar, but does not change the page

I am trying to redirect a user to a new page if a login is successful in my React app. The redirect is called from the auth service which is not a component. To

eip.js - Basic edit in place plugin in jQuery

I'm using this edit in place jQuery plugin. I'm trying to set the Ajax request to the back-end server with details. But it didn't work, it seems the plugin eip.

Getting "Uncaught ReferenceError: i is not defined" error whenever I want to use an exported element from another file

I'm developing a chrome extension using webpack and babel. I have this popup.js: import 'regenerator-runtime/runtime' // This is required in every JS files that

How can I find the value from another value in the same line with JavaScript (JSON)?

I am trying to get the "correctAnswers" from a number. Here a is sample of the JSON: { "questions": [ { "number": 3, "question": "☀ʊ

Stopping timer at end of block using javascript

I am new to this. I have a Qaultrics survey consisting of different blocks; each block with its own timer. What I want to achieve is the following; if participa

How to use template literals of ES6 script

I have been trying to solve a template literal question on hackerrank. It works fine on my local IDE but giving error on Hackerrank IDE. Heres the code two add

Charts js - how to change the scale of y axis?

https://github.com/chartjs/chartjs-plugin-datalabels/issues/315 I would like to customize the bar cart height by changing the y-axis scale to fit the white spac

eip.js - Basic edit in place plugin in jQuery

I'm using this edit in place jQuery plugin. I'm trying to set the Ajax request to the back-end server with details. But it didn't work, it seems the plugin eip.

Getting "Uncaught ReferenceError: i is not defined" error whenever I want to use an exported element from another file

I'm developing a chrome extension using webpack and babel. I have this popup.js: import 'regenerator-runtime/runtime' // This is required in every JS files that

Stopping timer at end of block using javascript

I am new to this. I have a Qaultrics survey consisting of different blocks; each block with its own timer. What I want to achieve is the following; if participa

How I could use template literals in javascript in a variable name?

I want to declare a variable name via template literals How it is possible ? let z = 3; let test`${z}` = "hello"; //or = new obj() for example console.log

Turning a function based sketch object oriented

I am trying to take Dan Shiffman's prime spiral program and make it object oriented. I am putting all variables into the constructor and making the functions in

NodeJS with ESM: internal/process/promises:246 | triggerUncaughtException(err, true /* fromPromise */) | finalizer.unsubscribe is not a function

I am creating an observable (RxJS) in NodeJS using ESM. Inside the observable I am performing a query with mongoose. I get the result, but the console returns e

How to get variable from JavaScript to PHP [duplicate]

i need to transfer a variable from js to a php page then insert it in the database the Js code function tableText(tableCell) { var x

$scope variable getting updated before getting displayed from api requests

I am attempting to get JSON Data Array using API and Display the same on Webpage. The problem I am encountering is the Element in the Webpage is being loaded as

Firebase / Firestore Add Document to Sub collection Version 9

Some reason, I just am not getting it. I want to add a new document to a sub-collection. Here is my layout as follows: Users----------- Collection UID--------

What I am doing wrong when testing this method?

I am trying to test a method within a service that performs an http post. I have mock the service in my spec.ts and all seems correct for me, but the boolean va

Should we build Mongoose queries on the frontend or backend?

We can build complex queries with Mongoose with options like $lte, $gt, $ne and so on... but I'm wondering where/how we should build those queries? If I have a

How to return state data from vuex action in components

I have an action that fetches data from my database, I assign the response from the request to various objects/variables in the state in my vuex store, this act