About 914,000 results
Open links in new tab
  1. How to return values in javascript - Stack Overflow

    Feb 23, 2017 · 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 …

  2. JavaScript return Statement - W3Schools

    // 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; }

  3. return - JavaScript | MDN - MDN Web Docs

    Mar 13, 2025 · 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 …

  4. 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.

  5. Reduce in javascript with initial value - Stack Overflow

    Mar 26, 2021 · This is the syntax provided by MDN for using an initial value: [0, 1, 2, 3, 4].reduce((accumulator, currentValue, currentIndex, array) => { return accumulator + …

  6. A Guide To The Reduce Method In Javascript - freeCodeCamp.org

    Feb 11, 2017 · By omitting the initial value, the total will default to the first amount in the array. By setting the initial value to an empty array we can then push each amount into the total. If we …

  7. JavaScript return Statement: Returning Value from Function

    Feb 6, 2025 · A comprehensive guide to the JavaScript return statement, covering its purpose, usage, and importance in functions for returning values and controlling execution flow.

  8. How Do I Return A Value From A JavaScript Function?

    In this comprehensive guide, we’ll explore the ins and outs of returning values from JavaScript functions, including the return statement, multiple return values, and best practices.

  9. Function return values - Learn web development | MDN

    Apr 28, 2025 · 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 …

  10. 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 …

Refresh