Found 6 articles tagged with #functions

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.

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.

How to take unlimited arguments in JavaScript

One way is to use the arguments object, the other is to use the rest parameter syntax.

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.