paint-brush
Avoiding infinite loops inside JavaScript callbacks - a TDD approachby@moran.weber1
3,788 reads
3,788 reads

Avoiding infinite loops inside JavaScript callbacks - a TDD approach

by Moran Weber4mApril 15th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<strong>One of the best known problems in all of computer science is </strong><a href="https://en.wikipedia.org/wiki/Halting_problem" target="_blank"><strong>the halting problem</strong></a>. Basically this is the problem of <a href="https://hackernoon.com/tagged/determining" target="_blank">determining</a>, from a description of a computer program and an input, whether the program will finish running or continue to run forever. Way back in 1936 the famous Alan Turing <a href="https://en.wikipedia.org/wiki/Halting_problem" target="_blank">proved</a> that it’s impossible to provide a general algorithm to solve the halting problem for all possible program — input pairs. In other words, you can’t write code that will always be able to determine whether your program is going to finish, or will get stuck in an infinite loop. Obviously I’m not going to prove Alan Turing wrong, but I have recently came up with some code that can make sure that a specific code, which is very common to many <a href="https://hackernoon.com/tagged/javascript" target="_blank">JavaScript</a> applications, won’t enter an infinite loop.

Coin Mentioned

Mention Thumbnail
featured image - Avoiding infinite loops inside JavaScript callbacks - a TDD approach
Moran Weber HackerNoon profile picture
Moran Weber

Moran Weber

@moran.weber1

L O A D I N G
. . . comments & more!

About Author

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite