Skip to content

-Clearing-SetTimeout-with-JavaScript- #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ To begin with, I want to start by thanking everyone for the massive review and l

How to use and the purpose of this project:

1:This project was intensively developed with the motive of ensuring prevention and improvement of proactive security software for the protection of an organization infrastructure.
1: This project was intensively developed with the motive of ensuring prevention and improvement of proactive security software for the protection of an organization infrastructure.

2:Before rolling on the real deal, an indepth knowledge of html,css and Javascript is needed to be able to understand how to clear settimeout funtion with Javascript because it's kinda tricky if this is your first time here.
2: Before rolling on the real deal, an indepth knowledge of html,css and Javascript is needed to be able to understand how to clear settimeout funtion with Javascript because it's kinda tricky if this is your first time here.

3:First thing first, make sure you've created or will create a nice template on your html file to be able to fit in on this project.
3: First thing first, make sure you've created or will create a nice template on your html file to be able to fit in on this project.

4:After which, link your Js.file with your html file. then use an attribute selector to make it more easier for you to get your elements to your Js.file at once. as seen on my time.js file. moreover, if you're new in programming then you've nothing to worry about because I'll stick with you throughout this project or problem solving because it's a very tricky one to work on alone. this will automatically lead us to the 5th step.
4: After which, link your Js.file with your html file. then use an attribute selector to make it more easier for you to get your elements to your Js.file at once. as seen on my time.js file. moreover, if you're new in programming then you've nothing to worry about because I'll stick with you throughout this project or problem solving because it's a very tricky one to work on alone. this will automatically lead us to the 5th step.

5:in addition, the fifth step should be an easy one for everyone. after you must've selected the required element from your html file. then create a constant variable by using the word "LET" and assign a value to it. remember assigning a value at this point depends on how and when you want the security protocol or the settimeout to execute on your program. as seen on my time.js, I used 200 as my value and it's applicable on your end if you wish.
5: in addition, the fifth step should be an easy one for everyone. after you must've selected the required element from your html file. then create a constant variable by using the word "LET" and assign a value to it. remember assigning a value at this point depends on how and when you want the security protocol or the settimeout to execute on your program. as seen on my time.js, I used 200 as my value and it's applicable on your end if you wish.

6:the next step is where a reaquired function timer() was created. don't worry if you don't know how to create a function in Javascript, you're 100% free to access and use my work template. on that note, the timer function will execute whenever the initial function is been called outside the gobal function. don't get afraid yet alright hahaha!. alright, A global function is a function that is defined outside of a class or struct and can be accessed from anywhere in the program. after which assign your input element.innerHTML = time.
6: the next step is where a reaquired function timer() was created. don't worry if you don't know how to create a function in Javascript, you're 100% free to access and use my work template. on that note, the timer function will execute whenever the initial function is been called outside the gobal function. don't get afraid yet alright hahaha!. alright, A global function is a function that is defined outside of a class or struct and can be accessed from anywhere in the program. after which assign your input element.innerHTML = time.

7:in this step, you'll create another constant veriable which will be assign to setinterval function and set the time you want as a timer. it's usally caculated in sec which is 1000 = 1sec. haven't understood how to assign and store the setinterval function to a varibale which I named as timing on my time.js file.
7: in this step, you'll create another constant veriable which will be assign to setinterval function and set the time you want as a timer. it's usally caculated in sec which is 1000 = 1sec. haven't understood how to assign and store the setinterval function to a varibale which I named as timing on my time.js file.

8:The setTimeout is a function method which will perform the timeout task and clear the time you set on your initial variable as seen on my time.js mine was set as 200. and these can only be done once so be careful when setting your varibale.
8: The setTimeout is a function method which will perform the timeout task and clear the time you set on your initial variable as seen on my time.js mine was set as 200. and these can only be done once so be careful when setting your varibale.

9:on the next, create a settimeout function after or on the next line of your code and inside your function, use the key word "clearTimeout(timing)" to store the veriable you assign to the setInterval function which is "timing" on my end.
9: on the next, create a settimeout function after or on the next line of your code and inside your function, use the key word "clearTimeout(timing)" to store the veriable you assign to the setInterval function which is "timing" on my end.

10:lastly, you can clear the timer function by using assignment operator mutiply(*), by mutiplying the variable time(value) which 200 * 1000(timer) to be able to iterate and perform its expected function at the right time. I presumed that we must've assimilated alot today.
10: lastly, you can clear the timer function by using assignment operator mutiply(*), by mutiplying the variable time(value) which 200 * 1000(timer) to be able to iterate and perform its expected function at the right time. I presumed that we must've assimilated alot today.

Just a recap for quick understanding, to solve this problem you need two responsive functions which are the setinterval function that take care of the timer while the settimeout function is responsible to execute any function for clearing of the time that's been assign by the programmer at the initial stage.

Expand Down