#functions

Found 6 articles tagged with #functions

How to take unlimited arguments in JavaScript

Some functions are designed to be very flexible and general-purpose. By allowing an arbitrary number of arguments, a function can adapt to a variety of situations.

How to use variadic parameters in Swift

Variadic parameters are useful when you want to create a function that can take any number of arguments of a specific type without specifying them individually.

Mar 03, 2024#swift#functions

How to return multiple values in JavaScript

If there are multiple pieces of data that are logically related to each other, it makes sense to group them together and return them as a single unit.

Difference between *args and **kwargs in Python

In summary *args collects the extra positional arguments as a tuple, while **kwargs collects the extra keyword arguments as a dictionary.

Jan 02, 2024#python#functions

Mastering recursive functions in JavaScript

A recursive function typically has a base case that stops the recursion and one or more recursive cases that call the function itself.

When are anonymous functions useful in JavaScript

Anonymous functions are commonly used in IIFEs (Immediately Invoked Function Expressions), callbacks, closures, event handlers, etc.