Skip to content

Tag: javascript

Understanding Promises in Javascript

I was trying to comprehend the use of Promise in Javascript for which Google search lead me to this article The author of post points out this Promises (like callbacks) allow us to wait on certain code to finish execution prior to running the next bit of code. Which for some reason sounded like this to me (an…

Making my own ForEach() javascript – element is not defined

I am making my own implementation of forEach in javascript, with the sole purpose of understanding the language better. To be more specific the temporary goal is to understand callbacks better. This is how far I got until I got stuck. I get the following error when running in node: I suspect it is because whe…

How to deal with a ref within a loop?

Below is my parent component with multiple inputs from a loop. How can I choose one input to focus? Do I have to create a dynamic ref in this case? Answer You can use callback refs to generate and store the dynamic ref of each input in an array. Now you can refer to them using the index of the