Skip to content

Testing window.location in jest

I am trying to test the window functionality via jest. I have a function which appends a query param to the url and redirects the page to the other page. A rough snippet of the code is below: I am new to jest and I am facing a bit of difficulty simulating the mock test for this, hence can you

TOP Etch-a-sketch grid resizing

I’m trying to complete The Odin Project’s Etch-a-Sketch challenge and am currently stuck with trying to resize the divs that make up the sketchpad. The app creates a 16×16 grid by default, and when pressing the erase button it asks for a number. It should then recreate the grid based on that …

How can I loop through two sets of numbers?

I’ve got two small puzzles that I can’t quite figure out! I need to loop through two sets of numbers indefinitely, one first and then the other with a 10 second pause between each one in which both values go back to -1. Both start at -1 and both go up to 2. I can loop through the first number

Update array elements

I am trying to do something similar to a shopping cart, where initially there is a series of products that I load with an array of objects. I show the list of products with svelte like this: And through the function addProduct() I update the array inventory with the product id and the number of units of that …

How can I get iOS to have 2 video streams?

Right now if I use my iPhone or iPad and try to display two streams, one is black and the other works. What can I do to get both working? This works fine on all browsers with my laptop. Answer Safari on iOS does not support more than a single active camera at a time. https://bugs.webkit.org/show_bug.cgi?id=23…

ReactJS OnClick Function that Changes State Not Rerendering

I am trying to create a floodfill visualization that allows the user to enter the grid size and the grid adjusts dynamically however, the grid is composed of buttons that have an onClick function that would then trigger the floodfill. I read up on the setState function and it says its asynchronous which is th…