当前位置:网站首页>How many way of calling a function?
How many way of calling a function?
2022-08-03 22:26:00 【Chinese front end】
In JavaScriptThere are 4 ways to call a function.Call to determine the function's value or "owner" object.this
- Call as a function - If a function is not called as a method, constructor, or using the
apply,callmethods, it is called byCalled as a function.The "owner" object for this function will be thewindowobject.
//Global Scopefunction add(a,b){console.log(this);return a + b;}add(1,5); // logs the "window" object and returns 6const o = {method(callback){callback();}}o.method(function(){console.log(this); // logs the "window" object});- Call as method - if the object's property has the value of the function,
边栏推荐
猜你喜欢

pikachu Over permission 越权

21天打卡挑战学习MySQL——《MySQL工具的使用》第一周 第二篇

生成器版和查看器版有什么区别?

藏宝计划TreasureProject(TPC)系统模式开发技术原理

encapsulation, package, access modifier, static variable

Pay from 0 to 1

HCIP BGP实验报告

FinClip最易用的智能电视小程序

Network basic learning series four (network layer, data link layer and some other important protocols or technologies)

CAS:1620523-64-9_Azide-SS-biotin_biotin-disulfide-azide
随机推荐
Embedded systems: overview
Nine ways to teach you to read the file path in the resources directory
Golang Chapter 2: Program Structure
LabVIEW代码生成错误 61056
PowerMockup 4.3.4::::Crack
Golang Chapter 1: Getting Started
伴随着元宇宙、web3.0等概念的兴起,数字人、数字场景等诸多数字化的形态开始出现
Network basic learning series four (network layer, data link layer and some other important protocols or technologies)
如何基于WPF写一款数据库文档管理工具(二)
如何创建一个Web项目
pikachu Over permission 越权
for loop exercises
[b01lers2020]Life on Mars
Teach a Man How to Fish - How to Query the Properties of Any SAP UI5 Control by Yourself Documentation and Technical Implementation Details Demo
encapsulation, package, access modifier, static variable
The development status of cloud computing at home and abroad
override学习(父类和子类)
静态文件快速建站
【bug】汇总Elipse项目中代码中文乱码解决方法!
重发布实验报告