All Questions
21 questions
0
votes
1
answer
106
views
Javascript learning 2nd iteration of if for loop - School work
Updated: Halfway Solved:
I was able to solve the main function of getting the start variables to reach the end nodes. I am lost again on how to track the path i took and and it to console log or a ...
0
votes
2
answers
68
views
Iteration and function sequence in Javascript
This is a true or false quiz. I need the score for the final answer to be updated before the alerts display either the winning or losing alerts.
The below code results in 9 of the 10 scores being ...
-1
votes
1
answer
30
views
Add to object with every iteration without replacing
I have an object outside of the function that I want to populate with every iteration and call that object after the iteration is done but I am only able to see the last element in my object. How do I ...
0
votes
1
answer
253
views
How can I create a function that check boolean field in array of object javascript
The final goal: if all the field are true the last object.field must change to true
const badges = [
{ name: "peter", given : true, points: 10 },
{ name: "Alice", given : ...
0
votes
4
answers
68
views
Creating an Iterative - Javascipt
I have a recursive function below and I was just wondering how can I create an iterative (i.e. loops without recursion) for the same thing. I would really appreciate any help or suggestions thank you!
...
0
votes
1
answer
751
views
How to bind to a context if one is passed?
I have written this function, that basically emulates the Underscore.js function of the same name. All is working correctly, except I am struggling to understand how to bind to the context if one is ...
1
vote
2
answers
42
views
Why is my basic recursion looping infinitely?
let data = [1, 2, 3]
let sorted = []
let push = function(i) {
while(i<data.length) {
sorted.push(data[i])
push(i + 1)
}
}
push(0)
Hey guys,
I am writing some basic recursion and it ...
0
votes
0
answers
17
views
Unable to access iteration items from nested function calls in JS [duplicate]
I know there are some related posts and I have gone through them, but I have not been able to make my code work. The provided code is a simplified portion of a larger code base. As you can see below, ...
0
votes
0
answers
40
views
Execute javascript function in only one of multiple modals
Well, here's the thing. I have two modals on my view. The first one called #modal1 and the second one #modal2.
I have a function named "a" that executes an "each" iteration that looks like this:
...
0
votes
1
answer
57
views
User Input to Make Decisions using Iteration
My code is a version of an old game Mastermind and is supposed to guess my secret code, and if user guesses the right character it prints letter green, if its right character wrong place it prints out ...
2
votes
2
answers
73
views
Arguments for the Seek and Destroy Freecode camp challenge
I'm trying to understand the Seek and Destroy challenge below.
Task: You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. ...
0
votes
3
answers
229
views
returning a function value inside an iterator without exiting in javascript
I am not sure if my title fits my question but here it goes.
I have an iterator runs every 1 second and a function that goes like this:
function getValue(val) {
return val;
}
function test() {
...
2
votes
2
answers
1k
views
is it possible to assign id name to a variable and use it in a function in javascript
I am creating an html form that will take quantity values in input for items and calculate the individual total cost and show it adjacent to each input box and show the grand total at the bottom of ...
3
votes
2
answers
1k
views
Iterate an array into a custom grid
I have a gird similar with a table with columns and rows but custom created with divs and spans and I want to populate every cell with values from many arrays and is not really working :|
so this is ...
1
vote
1
answer
172
views
How to convert this recursive function to a iterative one? (var_dump in javascript)
I'm new here and I'm trying to convert a recursive function to iterative.
I have been reading about the subject for some days and I have found some good sites that gave me ideas to try. But I couldn'...