Région de recherche :

Date :

https://developer.mozilla.org › fr › docs › Web › JavaScript › Reference › Statements › return

return - JavaScript | MDN - MDN Web Docs

L'instruction return met fin à l'exécution d'une fonction et définit une valeur à renvoyer à la fonction appelante. Exemple interactif. Syntaxe. js. return [expression]; expression. L'expression dont on souhaite renvoyer la valeur. Si elle est absente, la valeur renvoyée par défaut sera undefined. Description.

https://stackoverflow.com › questions › 5887386

How to return values in javascript - Stack Overflow

You can return an array, an object literal, or an object of a type you created that encapsulates the returned values. Then you can pass in the array, object literal, or custom object into a method to disseminate the values. Object example: var returnedObject = {}; returnedObject["value1"] = value1;

https://www.w3schools.com › jsref › jsref_return.asp

JavaScript return Statement - W3Schools

Syntax. return value; Parameters. More Examples. Calculate the product of two numbers and return the result: // Call a function and save the return value in x: var x = myFunction (4, 3); function myFunction (a, b) { // Return the product of a and b. return a * b; } Try it Yourself » Related Pages. JavaScript Tutorial: JavaScript Functions.

https://developer.mozilla.org › en-US › docs › Learn › JavaScript › Building_blocks › Return_values

Function return values - Learn web development | MDN - MDN Web Docs

Some functions don't return a significant value, but others do. It's important to understand what their values are, how to use them in your code, and how to make functions return useful values. We'll cover all of these below.

https://developer.mozilla.org › fr › docs › Learn › JavaScript › Building_blocks › Return_values

Valeurs de retour des fonctions - Apprendre le développement web - MDN

Pour retourner une valeur d'une fonction que vous avez créée, vous devez utiliser le mot-clef return. Nous avons vu son utilisation dans l'exemple random-canvas-circles.html. La fonction draw() dessine 100 cercles aléatoires dans un élément HTML <canvas> : js. function draw() { .

https://www.delftstack.com › fr › howto › javascript › javascript-return-values

Valeurs de retour d'une fonction en JavaScript - Delft Stack

La fonction peut renvoyer n’importe quoi comme un tableau, un objet littéral, une chaîne, un entier, une valeur booléenne ou un objet d’un type personnalisé que vous créez qui encapsule les valeurs de retour.

https://web.dev › learn › javascript › functions › return

The return keyword - web.dev

Use return to specify the value that the function should produce as a final result. When the interpreter reaches a return statement, the function that contains that statement immediately ends, and the specified value is returned to the context where the function was called:

https://www.geeksforgeeks.org › how-to-use-return-in-javascript

How to use Return in JavaScript - GeeksforGeeks

JavaScript allows us to use the return statement to end the function’s execution to specify the value that needs to be returned to the code that is calling it. Below are the methods and examples of how to use a return statement in JavaScript.

https://runebook.dev › fr › docs › javascript › statements › return

JavaScript - return [fr] - Runebook.dev

L'instruction return termine l'exécution de la fonction et spécifie une valeur à renvoyer à l'appelant de la fonction.

https://www.freecodecamp.org › news › javascript-return-statements

JavaScript Return Statements - freeCodeCamp.org

When a function returns a value, the value can be assigned to a variable using the assignment operator (=). In the example below, the function returns the square of the argument. When the function resolves or ends, its value is the returned value. The value is then assigned to the variable squared2.