English 中文(简体)
什么是功能表达? [复制]
原标题:What really is a function expression? [duplicate]

如果功能表述涉及储存地的变数中的功能价值,或者实际上只是功能价值? 那么,总是会看到“功能表述”一词指整个功能。

const funcExp = function(){console.log("Hello World!")};

但我想到的是:

function(){console.log("Hello World!")}

如果你问我,我会说,功能表达只是功能价值本身,而这种作用基本上是一种单纯的匿名功能,那么就没有了。 i 可能是错误的。 您是否真的认为,将这一匿名职能称为不知会吗?

const funcExp = function(){console.log("Hello World!")};

i mean in some way already has a name, not directly as part of the function value, but as part of the variable in where its stored, so i don t know i just want to know what really is a function expression, the whole variable creation initialized with a function value or only that function value, if the first turns to be true then how do we call this type of function values function(){console.log("Hello World!")}? function expression also?; thanks.

问题回答

因此,始终认为“功能表达”一词指整个束缚。

从技术上讲,只有<代码>功能(>){console.log(“Hello World>>>>>>>部分功能表述。 左侧是可变的声明。 但是,人们有时会用“功能表达”这一整个事物,将其与“功能声明”区分开来。 例如,作为独立的一线,以下是功能声明:

function func() {console.log("Hello World!")};

Btw, if you re interested in the technical names of the various bits of syntax, i recommend playing around with https://astexplorer.net/ . You can paste in javascript and it will show a tree structure of what the various pieces of code are

i could be wrong but.. do you really don’t think that would be strange to call this an anonymous function?:

由于你立即将其分配给一个名为<代码>funcExp的变量,实际上它确实有一个名字。 例如,尝试如下:

const funcExp = function(){console.log("Hello World!")};
console.log(funcExp.name)

因此,我个人不会使用“匿名功能”这一术语,因为它是以姓名为最终。 如果你不把它分配给一个变量,那么它就获得一个名字,然后是<>。 匿名:

function logName(fn) {
  console.log(fn.name);
}

logName(function(){console.log("Hello World!")})




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签