logo
  • 教程列表
  • SO官方文檔
  • 箭頭函式
    • 箭頭函式介紹
    • 詞彙範圍繫結(價值)
    • 引數物件
    • 隱式返回
    • 箭頭用作建構函式
    • 顯式返回
  1. StackOverflow 文件
  2. JavaScript 教程
  3. 箭頭函式
  4. 顯式返回

顯式返回

Created: November-22, 2018

箭頭函式的行為與經典函式非常相似,因為你可以使用 return 關鍵字從它們顯式返回值; 只需將函式的主體包裹在花括號中,然後返回一個值:

const foo = x => {
  return x + 1;
}

foo(1); // -> 2
  • 箭頭用作建構函式

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明