Category "javascript"

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

Embedding Checkout

I'm trying to embed the checkout of GiftUp on my angular site however not show when I run my HTML page. <div class="gift-up-target" data-site-id="XXXXXXXXXXX

Property 'authorization' does not exist on type 'Request'

Consider this code: setContext(async (req, { headers }) => { const token = await getToken(config.resources.gatewayApi.scopes) const completeHeader

How to set Gutter marker for all lines in react-codemirror2?

I'm using react-codemirror2 to implement a code editor. I want to set the gutter marker for all the lines. We can use setGutterMarker method to set gutterMaker

Color the cell of a table depending on the value using javascript

I am trying to color cells of an HTML table (which is automatically generated by Python and Django) depending on cells' content. Here is my table. I would like

componentDidMount affects other component

I have a price counter component. When I try to decrease a product qty to 0 it is deleted successfully but it affects the following product's qty and gives it 0

Office.js | Desktop excel | restrict user to interact with excel or add-ins pane if dialog is open

I am using office.js to create excel add-ins. I do have requirement to open dialog box from task pane and show task pane content in to the dialog box. To show t

React Boostrap Select, First Select Option ins not triggered by onChange event

I'm using React Boostrap Select component : <Form.Group className="mb-1"> <Form.Label htmlFor="type" className="iig-form-label d-inli

Getting CORS error when using facebook graph API

I used facebook live comments API to retrieve live video comments. I able to do it successfully when in local environment. But when I deploy the project with do

Tenor API search varied results

I'm making a Discord bot. Currently where if you type -gif **arguments** it uses the Tenor API and posts the result of the gif within a message which does work

How should I design with React/Typescript: Server sends list of steps. Each step has a type and payload

I'm looking for some good ideas on software design for this problem: A server sends an array of Steps: type StepTypeEnum = 'SECURITY' | 'PERSONAL_DETAILS' | ...

How to assign key to each Item or value in array in javascript?

I have an array like this: [link1,link2,link3] But I want it like this: [uri:link1,uri:link2,uri:link3] Please guide me over this. Thanks.