Category "javascript"

Vue3 Creating Component Instances Programmatically on button click

In vue2 it was be easy: <template> <button :class="type"><slot /></button> </template> <script> export default { name:

Chart.js 3.x migration problem – thin white border / padding appears around chart on first load

I'm using Chart.js with a React wrapper (react-chartjs-2). I want to upgrade to the latest major version of Chart.js (3.x) to remove the dependency on moment, a

Difficulty in create regex [duplicate]

40 I'm having trouble checking in React Js if a value is is any of the following combinations no spaces in starting Ramaining accept anything(

Reduce javascript map change key dynamically

I would like to have the array in output using the input array in the reduce function. But I can't manage to dynamically add a key like this "${keyOrigin}": cur

Google Sheets Index Sidebar of all tabs - add search functionality

After some searching I found this code to get a sidebar of all tabs (workbooks) in Google Sheets as a hyperlink. I am looking to add two functionalities to this

React console.log showing duplicate results in Dev Tools

Why does React show duplicate console.log? I found that to remove StrictMode from index.js. but there was no such problem before and why did I remove StrictMode

Page reloads when I use the setState function in React.js

When I use setState to change the object, the page reloads, resetting everything on the page. As I am making a tic-tac-toe app, either an X or 0 appears when I

Is it possible to disable the cursor from being recorded with getDisplayMedia()

I am recording my browser window using MediaStream and MediaRecorder. But need to disable the mouse cursor from being recorded, so when I create my video track,

accessing nested array key,value from json in javascript

I am new in javascript. It may be a basic thing but I am stuck with it. here is my json: { "statusCode": 200, "status": "success", "data": [

Is eslint pre-commit hook in CRA bootstrapped application required?

My react application is bootstrapped using CRA(react-scripts v4.0.0) and I want to add a code formatter (prettier to be specific) that must format the code befo

extract only sort function from code block

I am using the following bookmarklet to sort textarea ascending or descending. It is working as expected. But I do not need descending sort option and there is

Get Timezone from Google Places api autocomplete

I am trying to get the latitude, longitude and Timezone (India 5.30) from Google Places. The address is filled by autocomplete, and thus getting the latitude an

Snap to features of Vectortile layer using Openlayers

I want to snap to features in a Mapbox Vector tile (MVT) layer but failed to do so. Is there an example code or way to achieve this? Thank you.

Showing 0 to 0 of 0 entries (filtered from NaN total entries) In jQuery Datatable

Hi all I am new to jQuery Datatable. I am working on server-side for datatable. Most of things I have figured out but I am stuck on pagination part, currently I

textarea does not update after typing in it

I'm having an issue where the textarea does not update as expected. Here is a screenshot of my webapp: When I click on any of the buttons "EN", "ZH", "JP", or

how to convert the following syntax into an es6 syntax?

I have this statement to modularize my express.js api's: app.use("/api/users", require("./routes/api/users")); How to write it using import statement? inside "

Is there a way to pause and restart the webworker?

I have a problem with my webworker and hope that somebody can help me.. I have a browser side with two buttons - one starts my worker (numbers are getting incre

pdf.js text layer position accuracy

I'm using pdf.js and RecogitoJS to build a PDF annotation interface. This seems to work fairly ok. Except there's a small offset between the rendered canvas ima

Chrome's subpixel rendering affecting fixed/absolute positioned elements

I have a electron based application that provides a CAD like experience for mining engineers. This software includes a crosshair cursor: wide cursor that is st

Mini-Max Sum In JavaScript - How to Get the Minimum Sum And Maximum Sum of 4 Elements in a 5-Element Array

Link to HackerRank Challenge My idea is to loop through the array and sum all elements in the array except for one element each time, then find the smallest su