- Mastering JavaScript Functional Programming
- Federico Kereki
- 67字
- 2021-07-02 22:41:11
Testing the solution manually
We can run a simple test:
const squeak = a => console.log(a, " squeak!!");
squeak("original"); // "original squeak!!"
squeak("original"); // "original squeak!!"
squeak("original"); // "original squeak!!"
const squeakOnce = once(squeak);
squeakOnce("only once"); // "only once squeak!!"
squeakOnce("only once"); // no output
squeakOnce("only once"); // no output
Check out the results at CodePen, or see Figure 2.2:

Figure 2.2 - Testing our once() higher-order function
推薦閱讀
- Learning Selenium Testing Tools with Python
- R語(yǔ)言數(shù)據(jù)可視化之美:專業(yè)圖表繪制指南
- WSO2 Developer’s Guide
- OpenCV for Secret Agents
- Wireshark Network Security
- Lua程序設(shè)計(jì)(第4版)
- PHP+MySQL+Dreamweaver動(dòng)態(tài)網(wǎng)站開發(fā)實(shí)例教程
- Mastering Ext JS
- bbPress Complete
- Instant Lucene.NET
- Node Cookbook(Second Edition)
- Mastering Git
- Odoo 10 Implementation Cookbook
- JavaScript悟道
- 30天學(xué)通C#項(xiàng)目案例開發(fā)