当前位置:网站首页>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,
边栏推荐
猜你喜欢

Quickly build a website with static files

Cisco ike2 IPSec configuration

2022-08-03 Oracle executes slow SQL-Q17 comparison

嵌入式系统:概述

重发布实验报告

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

VLAN实验

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

如何设计 DAO 的 PoW 评判标准 并平衡不可能三角

斩获双奖|易知微荣获“2021中国数字孪生解决方案优秀供应商”“中国智能制造优秀推荐产品”双奖项!
随机推荐
【bug】汇总Elipse项目中代码中文乱码解决方法!
for loop exercises
Bytebase数据库 Schema 变更管理工具
【day1】
网络基础学习系列四(网络层,数据链路层和一些其他重要协议或技术)
pikachu Over permission
Research status of target detection at home and abroad
2022的七夕,奉上7个精美的表白代码,同时教大家快速改源码自用
navicat 连接 mongodb 报错[13][Unauthorized] command listDatabases requires authentication
pikachu Over permission 越权
win10系统下yolov5-V6.1版本的tensorrt部署细节教程及bug修改
[MySQL Advanced] Creation and Management of Databases and Tables
Boss: There are too many systems in the company, can you realize account interoperability?
[N1CTF 2018] eating_cms
480. Sliding Window Median
【MySQL进阶】数据库与表的创建和管理
云平台建设解决方案
投资性大于游戏性 NFT游戏到底是不是门好生意
FVCOM 3D Numerical Simulation of Hydrodynamics, Water Exchange, Dispersion and Transport of Oil Spills丨FVCOM Model Watershed, Numerical Simulation Method of Marine Water Environment
Embedded systems: overview