Skip to content
Advertisement

how to can i merge two functions into single function?

i want to make a table with JavaScript and i am fetching data from Api so i have created two function and i want to merge these functions in to single #output. my one function is fetch data from api and render out in table, second is fetch data from Api for filtering the data.

index.js

JavaScript

Advertisement

Answer

Basically just do one function that can accept filter and just check if that filter is provided, and if it is – then add to url your parameters. Quick one would be this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement