Open othman-shamla opened 5 years ago
https://github.com/FACG6/books-autocomplete/blob/05b6575b147d1e64971601b3af76ce41af0dd6c2/public/js/dom.js#L24 https://github.com/FACG6/books-autocomplete/blob/05b6575b147d1e64971601b3af76ce41af0dd6c2/public/js/dom.js#L27 https://github.com/FACG6/books-autocomplete/blob/05b6575b147d1e64971601b3af76ce41af0dd6c2/public/js/dom.js#L29 u can write it like this
const { value: inputValue } = bookSearch; if (inputValue.trim() == '') { alert('Enter some value'); } else if (inputValue != null) { fetchData('POST', inputValue, '/search', (response) => { if (response == '') { alert("no such value"); }
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assigning_to_new_variable_names
thanks for your opinion, I'll take care of it in next project (lack of time) thanks
https://github.com/FACG6/books-autocomplete/blob/05b6575b147d1e64971601b3af76ce41af0dd6c2/public/js/dom.js#L24 https://github.com/FACG6/books-autocomplete/blob/05b6575b147d1e64971601b3af76ce41af0dd6c2/public/js/dom.js#L27 https://github.com/FACG6/books-autocomplete/blob/05b6575b147d1e64971601b3af76ce41af0dd6c2/public/js/dom.js#L29 u can write it like this
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assigning_to_new_variable_names