Skip to content
Advertisement

Tag: loops

Looping through and reducing nested array

I can’t seem to get my head around the array.reduce() function. I’ve got the following array: and I’m trying to get a result like below. I’m not sure how to go about multiplying the ingredient amounts with the item quantities: I’ve tried following the structure that was given here but the arrow function is throwing me off. Any sort of

Dynamically append the element through JavaScript Dom

Hers’s question which I need answer Exercises: Level 1 Question 1 I tried to append the child dynamically and get the result vertical not in the compact manner as you will see in the question output when you go to the link You can see the code of both HTML and javascript above!!! Do help with the code where I

Can’t get values past array[0] to translate properly

Okay, to start with I should mention this is a very small personal project, and I’ve only have a handful of coding classes several years ago now. I can figure out a lot of the (very) basics, but have a hard time troubleshooting. I’m in a little bit over my head here, and need a dumbed down solution. I’m trying

Changing Values in a Form Causes Lag

I want to change the value of a from once a second, but when i use this code: The tab completely locks up, and I am forced to reload it. I have also tried using document.getElementById(“input”).value = “value”;, but that causes the same thing to happen. Does anyone know how to fix this (the form does not have a name)?

Loop prompt when input isn’t a month

I’m trying to loop the prompt when the user enters incorrect input. I googled and clicked almost all the top links, tried while loop and for loop and am just not getting anywhere. When I use the method i found of a loop, my button is no longer clickable or it clicks but when I input invalid month, no alert

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

Advertisement