Inside a function , I have seen the following code.
const searchName = input.value.toLowerCase(); input.value = '';
In the above code,in the 2nd line, input.value=’ ', makes the string empty instead of storing the name,then how this code serves the purpose?
The above example is taken from loops of mdn,[exiting loops with break statement]I have pasted the link below.
Hi @vaishnavi_A.N
The value of the input gets stored in the first line as “searchName”. The second line prepares the input field for the next input by clearing it. Further down you see the saved input value (as searchName) being used to look it up in “contacts”.
I hope that helps. Michael
Yeah got it @mikoMK,sorry for such silly question
There are no silly questions, just silly answers