I am new to javascript and I’m trying to make a web app that tests users and also lets them make tests. I’m currently focusing on the making-tests part of the web app. When the user enters the name of the test and the number of questions they want in the test, they click the button and then a javascript
Tag: for-loop
How do I keep incrementing the Elapsed time variable while its in the while loop instead of starting from 0 seconds everytime
I have a while loop where I look for two attributes in the array, if they’re not there, then I invoke the sleep function for 10 seconds and look for those attributes again. I want there to be an Elapsed time there so that the user can see how long we’ve been looking for those attributes. Expected output: Current Ouptut
How to get a property value from an array of objects in JavaScript
I want to make an array with country names from a JSON file which contains an array of objects. These objects have a property name with the name of the country, which is what I need. This is my JavaScript code which returns a list of undefined instead of country names: In the other hand, if I use forEach, I
Recursively Search in Array with a For Loop
I know there are better ways to search an array, but I really want to understand how to return when the value is found in a recursive call. Logging when found isn’t a problem, but I can’t seem to make this return true when found. The problem is basic. Fully search multi-dimensional array for a value and return true if
Write a function that takes in an array of integers, and a string that will be either ‘even’ or ‘odd’
Im working on a problem in javascript where I am supposed to write a function that takes in an array of integers, and a string that will be either ‘even’ or ‘odd’. The function will count how many times 4 even or 4 odd numbers show up in a row. For example: so far this is where I am at:
Append array of object values if index is the same index of a div list
I need help: I have one object with multiple array inside; i need to cycle all my array values and then append this values inside my HTML div list (with the same class). object[0] with div[0]; object[1] with div[1] ecc… This is an example: But this method return to me with a wrong result like this: First John Doe Second
How can I perform a reset on the loop I have when pressing a button?
I’m creating a code where 3 balls will bounce when a button is clicked. I have a code I found in the internet and added the start button but clicking it multiple times speed up the balls. Also, I tried adding a reset button that will clear out the canvas but can’t make it work. Sharing both the HTML and
Output Even Numbers In an Array
I want to write a program that receives a list of numbers, converts them into an array, and output the even numbers in the array with Modulus Operator and For Loop. The code does not run as expected: Thank you Answer It’s a matter of incorrect condition. i % 2 would give 0 for even numbers
Check if url contains blacklisted strings javascript
If i have an array of blacklisted words like so: and I’d like to check if myLink I got through a.getAttribute(“href”) contains one of those words what’d be the best way to go? Right now i’m trying this but it doesn’t work: full section: Answer Are you in a situation where you’re unable to use Array.prototype.findIndex? (I.e. you must support
Using a for loop with a function in Javascript [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question I am having trouble figuring out how to solve this challenge below: Challenge: droids Complete the function droids that accepts