From d9e9adb5f80a819fe46349bcf6d1faec734b09cd Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:07:31 +0800 Subject: remove span tag in zh-CN --- files/zh-cn/web/javascript/reference/operators/function/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/operators/function') diff --git a/files/zh-cn/web/javascript/reference/operators/function/index.html b/files/zh-cn/web/javascript/reference/operators/function/index.html index 73939d3da0..275ea3a02a 100644 --- a/files/zh-cn/web/javascript/reference/operators/function/index.html +++ b/files/zh-cn/web/javascript/reference/operators/function/index.html @@ -36,13 +36,13 @@ translation_of: Web/JavaScript/Reference/Operators/function

描述

-

函数表达式(function expression)非常类似于函数声明(function statement)(详情查看函数声明,并且两者拥有几乎相同的语法。函数表达式与函数声明的最主要区别是函数名称(function name),在函数表达式中可省略它,从而创建匿名函数(anonymous functions)。一个函数表达式可以被用作一个IIFE(Immediately Invoked Function Expression,即时调用的函数表达式),它一旦定义就运行。更多信息请查看函数

+

函数表达式(function expression)非常类似于函数声明(function statement)(详情查看函数声明),并且两者拥有几乎相同的语法。函数表达式与函数声明的最主要区别是函数名称(function name),在函数表达式中可省略它,从而创建匿名函数(anonymous functions)。一个函数表达式可以被用作一个IIFE(Immediately Invoked Function Expression,即时调用的函数表达式),它一旦定义就运行。更多信息请查看函数

 函数表达式提升 (Function expression hoisting)

JavaScript中的函数表达式没有提升,不像函数声明,你在定义函数表达式之前不能使用函数表达式:

-
 notHoisted(); // TypeError: notHoisted is not a function
+
 notHoisted(); // TypeError: notHoisted is not a function
 
 var notHoisted = function() {
    console.log('bar');
-- 
cgit v1.2.3-54-g00ecf