Manisha Patil

Manisha Patil

32 Articles Published

Articles by Manisha Patil

Page 4 of 4

Passing unknown number of arguments to a function in Javascript

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 3K+ Views

JavaScript allows functions to accept any number of arguments, even if the function definition specifies a different number of parameters. This flexibility is useful when creating functions that need to handle variable amounts of data. When defining a function, the variables listed in parentheses are called parameters. When calling the function, the actual values passed are called arguments. JavaScript provides two main approaches to handle unknown numbers of arguments. Basic Example: Fixed Parameters Functions with fixed parameters will only use the specified number of arguments, ignoring any extras: Passing ...

Read More

What is the drawback of creating true private methods in JavaScript?

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 470 Views

Private methods in JavaScript provide encapsulation by hiding internal functionality from external code. While they offer significant benefits like preventing naming conflicts and creating clean interfaces, true private methods come with notable drawbacks that developers should understand. JavaScript supports private methods through closures (using var, let, const) and ES2022 private class fields (using # prefix). Both approaches create truly private methods that cannot be accessed from outside the class. Main Drawbacks of True Private Methods Creating true private methods in JavaScript has two primary drawbacks: No External Access: Private methods cannot be called from outside ...

Read More
Showing 31–32 of 32 articles
« Prev 1 2 3 4 Next »
Advertisements