Skip to content

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

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

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

Javascript – Looping an object inside an loop

Not sure if I am phrasing this exactly but I have an object that I want to create a variable from to then append to a div in a page. I am doing this in javascript / Jquery. The object: Then I loop it to get the data but want to create a var of html to then append but