In TypeScript, how can I get a more specific subclass of a more generic class to allow referencing more specific properties and methods of that subclass when parent classes define them further up the inheritance tree? To explain my question, I think this code sums up what I’m trying to achieve: Note the…
Category: Questions
Fast Refresh with Next.js development mode in VS Code Remote Container/devcontainer
I can’t get Next.js’ Fast Refresh feature to work with a VS Code Remote Container. I can run npm run dev and see the app running on localhost on my machine, so the container works fine – only the Fast Refresh has no effect at all. Next.js version: v11.0.1 I tried this both with Windows 10 an…
Search through literal object and all its nested objects (up to nth level) with a generalized function [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. The community reviewed whether to reopen this question 1 year ago and left it closed: Original close reason(s) were…
How can I make an element visible on a page only when the html content height is bigger than the viewport height?
I have this page which is basically a to do list, where you can add an infinite number of tasks of every kind, and of course, if you add a lot of tasks the height of the page is going to get bigger, and the scollbar is going to appear. I also have this button fixed at the bottom right
Is their any way I can **not** round off the number while using parseInt?
when I don’t use parseInt: I need the array item’s as an number with decimal rather than a string. Answer parseInt converts to Integer. You want parseFloat :
Jquery loop over checkbox and check for non checked
I am wanting to loop over an checkbox input and check if the checkbox ISNT selected then add the value of the checkbox to an array which im wanting to POST through ajax. I have an example below of looping through checkboxes which are selected but how would i do the inverse of this while still including the .e…
Counting the occurrences in an array
I have a simple array such as: I want to display the element that has the highest occurrence, in this case “Jalkatreeni”. How should I go about doing it? Any neat tips are appreciated. 🙂 Thank you in advance! Answer Try the following. You can iterate through your array using .reduce(). In each ite…
how to find average prices from one array by crossing it to last 30 days from other array? javascript
I have these 2 arrays , one contains the time period, the second one contains the prices for each period. how can I output the average price for the last 30 days, 60 days, etc…? Answer Here I combine the two arrays using map() and make the time into a Data object. I create a Date object and reduce it
Trying to build a counter, very basic javascript question
I’m pretty new to writing code and I am using JavaScript and HTML in Visual Studio Code. I’ve been trying to solve the following exercise which is to create a button that counts how many times it is being pushed. The HTML part is done, but I’m stuck in the JavaScript part. Any advice to solv…
apis delcared in contextbridge undefined in render process
I’ve been working on updating a electron app from 11.x to 12.x and have run into an issue where the apis declared by contextBridge.exposeInMainWorld come as undefined when called upon through window. This is my preload.js file my app.js I’m lost on why contextBridge doesn’t work. Answer The …