Category "javascript"

Convert async function consul.kv.get to sync function with deasync

I am trying to convert an async function consul.kv.get to a sync version of the same function. Searching led me to deasync and it's documentation suggests I sho

How to toggle boolean state in React and TypeScript?

I am new to React and TypeScript. I want to toggle a boolean state (true/false) with a handler function. I've read other posts about how to do this in ES6 but

Why typescript keep giving me No inputs were found in config file error?

Why typescript keep giving me No inputs were found in config file error? When I use tsconfig.json in vscode, but when I try to build it, it gives me a 'No input

Cannot redefine property when trying change property of a global variable

How can we set custom getter/setter on already existing global variable? A straightforward approach fails: var myVar; { let _myVar = myVar; delete myVa

get folder directory from input type file - PHP

just a quick question, mission is to get a folder directory name. example: _C:\ThisFolder\myFolder_. and I've used html input type="file" but I'm only able to

How can I convert a windows path to posix path using node path

I'm developing on windows, but need to know how to convert a windows path (with backslashes \) into a POSIX path with forward slashes (/)? My goal is to conver

Get value from radio button Angular Material Dialog

I have Angular Material dialog , where I updating table clicking change status. I need to get value from radio button in my dialog Here is full working exampl

How do I check if a file name includes a variable in javascript?

So I am trying to make a save file system thing, and it creates a file with your username, but when you log in it checks the user saves file to see if theres a

getFieldDecorator rules for password to contain lower case upper case letters and numbers?

I am working on a react app and the views are built with Ant Design, I am validating a form and I don't know how to validate the password to contain chars of lo

Jest: ReferenceError: global is not defined

So I am writing unit test using "react-testing-library" on Jest and I have this error: Test suite failed to run ReferenceError: global is not defined

is there a way to prevent repeating code in html I'm using bootstrap 4 collapse like 20 times in one page

<div class="card" style> <div class="card-header" id="headingOne"> <h5 class="mb-0"> <button class="btn btn-lin

A-frame consitatnly animate gltf to go to position of camera A-frame

I am creating a vr scene using A-frame ( and I am wondering how can I animate a gltf model to always follow the camera. For example, I would l

Getting error exponentiation operator for BigInt

When i am trying to do (BigInt(Generator) ** this.privateKey) % BigInt(Prime) i am getting error: Exponentiation cannot be performed on 'bigint' values unless

How to map more than one property from an array of objects

I have an array of Object as follows: var obj = [ {a: 1, b: 5, c: 9}, {a: 2, b: 6, c: 10}, {a: 3, b: 7, c: 11}, {a: 4, b: 8, c: 12} ]; I know about how

Visual Studio Code - How to display variable values inline during debugging?

When I debug Javascript code in VS code or visual studio code, I would like it to show me the values of the variables alongside the code. How to make VS code do

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