当前位置:网站首页>Function executes only the once function for the first time
Function executes only the once function for the first time
2022-04-23 13:47:00 【Everything wins sy】
// Execute the function only once
function once(fn){
var ifFalse = true
return function(){
if(ifFalse){
ifFalse = false
fn()
}
}
}
// call
function getName(){
console.log(' My name is Chihuahua ')
}
getName = once(getName)
getName() //' My name is Chihuahua '
getName() // Don't execute
From the link :https://www.nowcoder.com/questionTerminal/42997185c50a45a08b64c253d2f1edc5?mutiTagIds=644&page=1&onlyReference=false
版权声明
本文为[Everything wins sy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231336214400.html
边栏推荐
- Use of GDB
- Use future and countdownlatch to realize multithreading to execute multiple asynchronous tasks, and return results after all tasks are completed
- 【项目】小帽外卖(八)
- GDB的使用
- 爱可可AI前沿推介 (4.23)
- Solve tp6 download error course not find package topthink / think with stability stable
- AI21 Labs | Standing on the Shoulders of Giant Frozen Language Models(站在巨大的冷冻语言模型的肩膀上)
- Small case of web login (including verification code login)
- Tensorflow Download
- Set Jianyun x Feishu Shennuo to help the enterprise operation Department realize office automation
猜你喜欢
Leetcode brush question 𞓜 13 Roman numeral to integer
Express②(路由)
Express ② (routage)
SQL learning | set operation
Dolphin scheduler source package Src tar. GZ decompression problem
Solution of discarding evaluate function in surprise Library
服务器中挖矿病毒了,屮
SQL learning window function
Android 面试主题集合整理
Leetcode? The first common node of two linked lists
随机推荐
[code analysis (3)] communication efficient learning of deep networks from decentralized data
SSM project deployed in Alibaba cloud
Modification of table fields by Oracle
19c RAC steps for modifying VIP and scanip - same network segment
Building MySQL environment under Ubuntu & getting to know SQL
Tensorflow Download
自动化的艺术
Oracle lock table query and unlocking method
Search ideas and cases of large amount of Oracle redo log
SAP ui5 application development tutorial 72 - trial version of animation effect setting of SAP ui5 page routing
[code analysis (4)] communication efficient learning of deep networks from decentralized data
Database transactions
Generate 32-bit UUID in Oracle
Lenovo Savior y9000x 2020
Detailed explanation and usage of with function in SQL
[Video] Bayesian inference in linear regression and R language prediction of workers' wage data | data sharing
At the same time, the problems of height collapse and outer margin overlap are solved
MySQL and PgSQL time related operations
Oracle clear SQL cache
Oracle kills the executing SQL