DEV Community

Mehul Lakhanpal
Mehul Lakhanpal

Posted on • Originally published at


Better way to accept arguments

function downloadData(url, resourceId, searchText, pageNo, limit) {}

downloadData(...); // need to remember the order
Enter fullscreen mode Exit fullscreen mode

Simpler way to do this-

function downloadData(
{ url, resourceId, searchText, pageNo, limit } = {}
) {}

  { resourceId: 2, url: "/posts", searchText: "programming" }
Enter fullscreen mode Exit fullscreen mode

Thanks for reading 💙

Follow for daily posts.


Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript

Top comments (0)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.