Category "javascript"

How to evaluate Vue.js component props in the data property?

I have 2 components: Post and Comments. Inside Post component, there is Comments component that has 3 props: postId, numCom (number of comments) and comments (

Property 'XXX' does not exist on type 'CombinedVueInstance<Vue, {}, {}, {}, Readonly<Record<never, any>>>'

I created a vue component with TypeScript, and I'm getting this error in data() and in methods(): Property 'xxx' does not exist on type 'CombinedVueInstance<

Scale current item to 1

I wonder how to scale the current index from 1 to 0.8 when swiping to the next item. I've been building a carousel on how to make the centered item from 1 to 0.

Joi - make everything required by default?

I'm building out a Node/Express API and using Joi for validation. It's a great package and has been incredibly useful. However, we're getting tired of doing thi

How can I assign the contents of a geojson file to a variable in Javascript?

The code shown already works, but I want to clean it up. It declares a variable called placez which contains information in geojson format for the next part of

Rerendering component and useReducer initialization

EDIT: below the line is the initial problem where I asked if my whole architecture was fine. I later edited the topic (and title) to go straight to what was my

Creating a promise chain in a for loop

I would expect the code below to print one number on the console, then wait a second and then print another number. Instead, it prints all 10 numbers immediatel

Joi - make everything required by default?

I'm building out a Node/Express API and using Joi for validation. It's a great package and has been incredibly useful. However, we're getting tired of doing thi

Problem with random embed messages discord.js

I am trying to do a command with random embeds, but when I trigger the command. It always sends the same option, and if I reload the bot, it's gonna choose a ne

How do you add multiple documents at once to a collection in Firestore?

I am somewhat new to Firebase and looking for the ability to write multiple JSON objects into a collection under random IDs in one operation. I am just using fi

How to create a progress bar in React?

I would like to add a progress bar to a minicart. The purpose of it is to show to users how much is needed to reach free shipping. Example: If you have items in

Mocking moment() and moment().format using jest

I'm unable to mock moment() or moment().format functions. I have states where, currentDateMoment and currentDateFormatted are getting set as below. currentDateM

Remove empty bar space in Group bar chart using Plot.ly javascript?

I have rendered a group bar chart with 3 bars in each group. But some times one or two bars could be empty. In that case, It's occupying space for ALL THREE bar

Firebase messaging warning messages on service worker install process

I'm using firebase for push web notifications, my file firebase-messaging-ws.js is something like this: importScripts('https://www.gstatic.com/firebasejs/7.19.

Mocking moment() and moment().format using jest

I'm unable to mock moment() or moment().format functions. I have states where, currentDateMoment and currentDateFormatted are getting set as below. currentDateM

nest Command not found

I followed the documentation to create my first NestJS project. Installing the Nest CLI with the command npm i -g @nestjs/cli was successful. The output was:

How can I use external buttons instead of the default Layers Control?

Instead of Leaflet default Layers Control with checkbox, I want to use an <a> tag, when I click on it, it shows all associated layers to that button. I ha

Could vue3 <script setup> use component is, how to make it work?

I am new beginner of vue3 and found that vue have three way to write component: <script setup> normal-setup/composition api options api. I know how to use

How to tell if navbar is collapsed or not?

I have a navbar: <nav id="navbar" class="navbar fixed-top navbar-expand-md navbar-light bg-light"> <a class="navbar-brand" href="#"></a> &

google.maps.event.addDomListener() is deprecated, use the standard addEventListener() method instead : Google Place autocomplete Error

I am trying to add Google place auto suggest, I copied the code from the developer's website to try it out but got the error : google.maps.event.addDomListener