About 3,720,000 results
Open links in new tab
  1. Using function's return value in if statement - Stack Overflow

    Jul 15, 2011 · Can you use a function's returned value in a if statement? I.e. function queryThis(request) { return false; } if(queryThis('foo') != false) { doThat(); } Very

  2. Javascript if condition with return - Stack Overflow

    Dec 2, 2011 · Use a variable and increment it once the condition is met. Then check to see if the variable was incremented. var count = 0; if (eval(code1)) { if (First condition) { alert("You cant …

  3. JavaScript shorthand if-else and returning - Stack Overflow

    Jan 30, 2012 · But if you merely wish to return early when a test evaluates true (for instance, as a sanity-check to prevent execution when parameters are invalid), the shortest you can make it …

  4. return - JavaScript | MDN - MDN Web Docs

    Mar 13, 2025 · The return statement ends function execution and specifies a value to be returned to the function caller. Try it function getRectArea(width, height) { if (width > 0 && height > 0) { …

  5. JavaScript if/else Statement - W3Schools

    The if/else statement executes a block of code if a specified condition is true. If the condition is false, another block of code can be executed. The if/else statement is a part of JavaScript's …

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

  7. If/else vs if/return: using implicit returns in Javascript and React

    Aug 14, 2018 · One of my favorite tricks lately is switching from the if/else format in Javascript to what I call an if/return structure, aka an implicit return. First, the basics. If you write Javascript, …

  8. If Statements, Function Returns, Truthy and Falsy - Beginner JavaScript

    What does return mean? It means to return a value from a function, and stop that function from running. Whenever you return from a function, even if it's inside of an if statement, that …

  9. Understanding the Behavior of Return Statements Inside If Statements

    In JavaScript, the return statement serves a crucial role in controlling the flow of function execution. When placed inside an if statement, the return statement exits the function and can …

  10. if...else - JavaScript | MDN - MDN Web Docs

    Mar 13, 2025 · The if...else statement executes a statement if a specified condition is truthy. If the condition is falsy, another statement in the optional else clause will be executed.

  11. Some results have been removed
Refresh