Category "javascript"

How to get the contents of a file as a String

I am new to Typescript and node. I have this function sftp.connect(config) //CONNECT TO STFP .then(() => { sftp.list(remoteFilePath) //LIST THE FILES IN

How to use class component without extending React.Component

I have been given in built ui kit which has class based component without extending React.Component. Now i need to use those UI components for building UserInte

How can I send JSON data from local storage to controller in Laravel?

I want to send the json data from view to controller using ajax. How can I achieve that? The data in local storage is [{"productId":2,"productCost":"630","produ

cant access state, react redux

I have a page with notes for a specific user, the problem is when i'm trying to access the state of 'my notes' i get 'undefined' on console, in postman, everyth

How to check whether all number elements in an array are even numbers with recursion?

I'm currently learning as much as I can about recursion but I'm really stuck on how to use it to check whether all the number elements in an array are even numb

Make persistent changes to HTML file using JavaScript [duplicate]

The code below saves the contents of a <textarea> to the DOM when the Save button is clicked. function save() { // Create the new el

How to throw an exception with a status code?

How can throw an error with options or a status code and then catch them? From the syntax here, it seems we can through the error with additional info: new Erro

Why does my Selenium script work only every other time?

I think I should start off by mentioning I have Mac OS and am using Safari browser. This script is a web-scraper that is supposed to search for a given type of

Webpack: Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object

I want to create custom component and build with webpack // packages/button/src/index.js import React from 'react'; function Button({ href }) { return <a

Critical dependency: the request of a dependency is an expression while using lazy loading

I am trying to dynamically import modules but getting following error - Compiled with problems:X WARNING in ./src/.../useCustomModule.js 21:21-56 Critical depen

Build an event handler using elements from two fetch/then chains

Context and goal I have two fetch/then chains that build elements that I need for an event handler. The first chain loads data to build a <select> element

How Can I Avoid This Warning ' A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from...'?

const AddItem = () => { const [user] = useAuthState(auth); const navigate = useNavigate(); const handleAddCar = (e) => { e.preventDefault()

JS Find the missing letter (alphabet - array)

Write a function that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array. It will be always exactly o

Link between two JavaScript objects and then create condition

I have this set of data : [ { CIRPIC: 'SAL', ALLPIC: [7, 8, 9, 10] }, { CIRPIC: 'SUC', ALLPIC: [5, 6, 7] }, { CIRPIC: 'LI3', A

How to replace my current regular expression without using negative lookbehind

I have the following regular expression which matches on all double quotes besides those that are escaped: i.e: The regular expression is as follows: ((?<![

No Typescript error for unresolved types in .d.ts files?

For as long as I can remember, Typescript didn't warn about unresolved/undefined types in .d.ts files. I could run tsc and it wouldn't have any errors. I alrea

Invariant Violation: requireNativeComponent: "BVLinearGradient"

I have been working with the react-native-gradient and I am getting the following error regarding the package. Error Invariant Violation: requireNativeComponent

make responsive flexible images that are rotated on a single line in tailwind css?

i want to recreate this effect that is visible on https://www.tella.tv/ in tailwind css: i tried to inspect their source code but i couldn't make it work in my

Express.js backend not saving cookie to Nuxt.js frontend

I've built an authorization server with Express.js that works when testing with Postman where it saves the access and rotating refresh token as signed cookies.

React Native FlatList Items Disappearing

I have a Modal that the user selects categories from, and then that category loads into a FlatList on their profile page. When the first category is selected, i