
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.
How To Use Return in JavaScript? - GeeksforGeeks
Feb 17, 2025 · The return statement in JavaScript is used to end a function execution and send a value back to where the function was called. It allows the function to provide useful results, like numbers, strings, or objects, that can be used in other parts of the code.
Returning a string in Javascript - Stack Overflow
Dec 29, 2012 · I am trying to create a simple function that will return the correct string when called: function getState (abbr) { if (abbr=="WY") { return "Wyoming"; } } and then the call is like this...
JavaScript Return Statement - GeeksforGeeks
Feb 7, 2025 · The return statement in JavaScript is used to end the execution of a function and return a value to the caller. It is used to control function behaviour and optimise code execution.
return - JavaScript | MDN - MDN Web Docs
Mar 13, 2025 · In a generator function, the produced generator object's next() method returns { done: true, value: returnedValue }. In an async generator function, the produced async …
How to return values in javascript - Stack Overflow
May 4, 2011 · 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.
javascript - Return a word from a string - Stack Overflow
Use .filter to return only those that have a repeated letter. Inside the filter, test if it has a repeated letter with regex and .test. Returns true if it does, adding it to the new array. const arr = words.split(" "); return arr.filter(word => (/([a-zA-Z]).*?\1/).test(word)); Regex for …
Return a String from a JavaScript Function - Online Tutorials …
Learn how to return a string from a JavaScript function with this comprehensive guide. Get examples and explanations to enhance your JavaScript skills.
Using JavaScript to Return String - Daztech
Feb 26, 2024 · In JavaScript, to return a string in a function, we simply need to use the return statement. Here is a very simple example.
JavaScript Return Statements - freeCodeCamp.org
Jan 21, 2020 · Introduction When a return statement is called in a function, the execution of this function is stopped. 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.)
- Some results have been removed