+ 1
Loops and Iteration
Please can someone tell me why this is iterating only once https://code.sololearn.com/WLQpJw32bC3Q/#html
22 ответов
+ 5
You don't have to say sorry for that.
Please check the everything.js post I just shared.
[...For local scripts, we put them before end tag of body, or as callback of load event of window object.
This ensures the JavaScript script runs after the DOM exists...]
Emebo Prosper The problem is that you're actually overwritting the innerHTML property instead of updating it. See Arb Rahim Badsa's answer.
+ 4
Your code expects a DOM element with "not" as id.
You didn't provide it in your HTML.
Add this in body:
<div id="not"></div>
Also remember that script from JS tag of CodePlayground are part of HTML head tag.
https://www.sololearn.com/post/90825/?ref=app
+ 2
I want it to do something like this, Please can you tell me why it is only iterating through the last one and why it is returning an error.
https://code.sololearn.com/W0huh4GrhBS0/#js
+ 1
Emebo Prosper I am not getting what you want to make. Do you want to store the usernames and passwords in the array?
+ 1
Okay let, me clear things up :
1) User will enter a username
2) The programe will generate a password using the first and last name of the username.
3) Then you want to show the username and password on the screen.
Is that so?
+ 1
Not really let me give you an over view
(1) new user creates account
(2) Application stores it in local storage as an array inside an array called accounts
(3) User logs in with user name, application fetches name from the dom and compares it with the one in the account array then adds it in local storage called current account.
(3)When the user generates password he saves the password with a name.
+ 1
(4) Then the application stores it as an array identifying the current then compares it with the one in local storage and stores as an array in local storage
+ 1
(5) The question i asked is about the dashboard i want it to get the password from local storage based on the user name in the account array that is in the local storage
+ 1
Thanks Arb Rahimb Badsa and kevin star i found the solution
+ 1
Emebo Prosper This should solve your issue :)) You can check it even though you've solved.
https://code.sololearn.com/W7Um4Avx19Fm/?ref=app
+ 1
Thank you boss for everything you made my complicated code easy
+ 1
That window.onload is the same thing as <body onload="myFunction()"></body> right
0
I sorry im coding on my computer so when i was pasting i forgot
0
I have modified that but it's still not working
0
Please i don't understand. But as far as i know in the execution stack all functions are called first
0
And on my computer the loop is only iterating once which is the last one, why??
0
The first name and last name is what will be used to recognise the passwords of the user
0
Then in the JavaScript where it s inputting as name that will be what the user will use to recognise the password he generated
0
So in that particular function the first name and last name is not needed that is why i removed it