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.

https://stackoverflow.com › questions › 9201653

javascript: determine functions return type - Stack Overflow

Is there a way in javascript to determine the return type(if any) of a function? example: function doSomething(){ return true; } to returned type is boolean. example 2: function doSomething2(x){ if(x=="a") return 1;//number else return "bad x"; //string }

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

JavaScript return Statement - W3Schools

The return statement stops the execution of a function and returns a value. Read our JavaScript Tutorial to learn all you need to know about functions. Start with the introduction chapter about JavaScript Functions and JavaScript Scope.

https://developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Statements › return

return - JavaScript | MDN - MDN Web Docs

In a plain function, the call to that function evaluates to the return value. In an async function, the produced promise is resolved with the returned value. In a generator function, the produced generator object's next() method returns { done: true, value: returnedValue } .

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://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: const myFunction = function() { return 2 + 2; } myFunction(); . > 4.

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://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. Syntax: function nameOfFunction() { return result // Value that need to be returned. } Table of Content.

https://www.w3schools.com › js › js_functions.asp

JavaScript Functions - W3Schools

Function Return. When JavaScript reaches a return statement, the function will stop executing. If the function was invoked from a statement, JavaScript will "return" to execute the code after the invoking statement. Functions often compute a return value. The return value is "returned" back to the "caller":

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

JavaScript Return Statements - freeCodeCamp.org

If specified, a given value is returned to the function caller. If the expression is omitted, undefined is returned instead. return expression; Functions can return: Primitive values (string, number, boolean, etc.) Object types (arrays, objects, functions, etc.) Never return something on a new line without using parentheses. This is ...