简体   繁体   English

函数声明与函数声明有什么区别? JavaScript 中的定义?

[英]What is the difference between function declaration Vs. definition in JavaScript?

There are examples here with C++ and Java but it'll be great if someone can explain this with JavaScript examples.这里有 C++ 和 Java 的例子,但如果有人能用 JavaScript 例子解释这一点,那就太好了。 Also how is definition Vs.定义 Vs 也如何。 declaration works for variables.声明适用于变量。

There is no notion of " function definitions " in JavaScript. JavaScript 中没有“函数定义”的概念。 It does only distinguish between function declarations and function expressions (and the deprecated function statements ).它只区分函数声明函数表达式(以及不推荐使用的函数语句)。

When we use the term "definition", it's typically meant as a hyperonym for both.当我们使用术语“定义”时,它通常是指两者的同义词。

It's similar for variables: there's only the term variable declaration in the standard, and when we use "variable definition" we either refer to that or the initialisation of the variable with a value (or both).它与变量类似:标准中只有术语变量声明,当我们使用“变量定义”时,我们要么指代它,要么指代变量的初始化(或两者)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用var与函数声明javascript对象有什么区别? - What is the difference between declaring javascript objects with var vs. with function? JavaScript 中的变量定义和声明有什么区别? - What's the difference between variable definition and declaration in JavaScript? 类方法与类字段函数与类字段箭头函数有什么区别? - What is the difference between class method vs. class field function vs. class field arrow function? Javascript - 命名空间与闭包之间的区别? - Javascript - difference between namespace vs. closure? javascript中这两个声明之间有什么区别 - what is the difference between these two declaration in javascript Javascript 中静态函数声明和普通函数声明的区别? - Difference between Static function declaration and the normal function declaration in Javascript? 分配给“ this”属性的javascript方法与原型中定义的方法之间有什么区别? - What's the difference between javascript methods assigned to properties of “this” vs. methods defined on the prototype? 使用常量操作道具与使用 function 操作道具有什么区别? - What's the difference between manipulating a prop using a constant vs. using a function? JavaScript中的函数定义。 但是实际区别是什么? - function definition in javascript. But what is the actual difference? javascript行为 - 函数表达式与函数声明 - 差异 - javascript behaviour - function expression vs function declaration - difference
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM