Category "javascript"

Restructuring the object using different name [Object manipulation]

I have a use case where I have to restructure the object. Initial I have this object { name: 'Tommy Kerar', mandatoryRequirements : [{ name:

How to render conditional with classNames with Reactjs

I am trying to use classNames to replace the conditional below in one line. My problem is that i am not sure what is the right way to write the code because of

How to enable pop-up iframe work on same page in react nextjs app

I have a pop-up that works very well in my vanilla Html app properly, that is, when the button is clicked, it opens the pop-up and everything works fine. The is

Create ref to external class component inside functional component in React

I would like to use react player library in my app import React, { useEffect, useRef } from "react"; import ReactPlayer from "react-player"; import { useSelect

How to initialize my contract with front end?

I've compiled and deployed my contract and tested it successfully and also connect Metamask to ganache and all works fine. The problem is when I try to interact

How to persist Expo Audio throughout react native app?

I am new to react native. I am trying to make a podcast player. While I was able to make it work in my Podcast component, when I change to other component, the

TypeError [INVALID_TYPE]: Supplied data.type is not a valid MessageComponentType - Discord.js

hey im trying to make a slashCommand that generate random pics with button.. so when a user use the command it will sent an embed with button and then the butto

How to use this Javascript animation in React.js

I have the code below and I'd like to know the best way to make it work in React.js. My main issue is that I can't comprehend the object orientation principle i

How can I fit a img into a div wholly?

.flexbox-item-1 { min-height: 300px; min-width: 300px; border: 3px solid red; overflow: hidden; /* background: url("./Zodiac_Logos_jpg/Aries_zodia

I am trying to create widget in next.js app

My website is almost complete on next.js. I am trying to create widget to one of my component that can be embedded on any website without iframe. Please help me

Do not close window after clicking 'X' button? [duplicate]

I want to show a dialog when users click the X button to close the browser's window. In the dialog, it will ask users if they want to proceed

YDNJS: scope and closures hoisting wrong example [duplicate]

I am reading YDNJS: scope and closures, And in chapter 4 which talks about hoisting it says that Function declarations that appear inside of

What is the most efficient way to deep clone an object in JavaScript?

What is the most efficient way to clone a JavaScript object? I've seen obj = eval(uneval(o)); being used, but that's non-standard and only sup

Automatic file downloads limited to 10 files on Chrome browser

I have a webpage where we generate PDFs based upon the user selection of on-page items. This causes a postback (it's an ASP.NET WebForms page) which creates the

filter array of objects by another array of objects

I want to filter array of objects by another array of objects. I have 2 array of objects like this: const array = [ { id: 1, name: 'a1', sub: { id: 6, nam

Google Apps Script trigger function runs twice

I have the following trigger setTrigger() set for when a Google Form is submitted. For testing purposes I created a simple function triggerFunction() that creat

H-Captcha can't verify captcha key/token

Here is my code: let result = await axios({ method: 'post', url: 'https://hcaptcha.com/siteverify', params: {

Live server installed but not working in VS code

I have installed the live server extension but the browser does not update after I save my HTML or other files. What might be causing a problem?

internal/modules/cjs/loader.js:582 throw err

I'm getting following Console Error. Error : Cannot find module Here is the full error i'm getting in console. What should I do? internal/modules/cjs/loader.j

Unable to render PDF to browser when retrieved from gridfs-stream

My Controller : - view: async (req, res) => { var id = req.params.pid id = mongoose.Types.ObjectId(id) const project = await P