- Published on
All Posts
- Published on
这篇我们来关注闭包 什么是闭包? 闭包是由函数和它所在词法环境组合而成的实体,这个环境包含了闭包创建时,所能访问的所有局部变量。所以当外部函数已经执行完后,依然可以通过闭包(内部函数)访问到当时词法环境的变量。 如何创建闭包: 1. 存在函数嵌套(在外部函数中,再定义一个内部函数) 2. 内部函数使用了外部函数中的变量 3. 内部函数被导出,包括三种场景:(1)直接将内部函数作为返回值;(2)作为...- Published on
The design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. I have learned some design patterns in the past, but I don't think I have ...- Published on
The error message displayed in my terminal was as follows: <tsconfigRootDir>/src\xxx.tsxparserOptions.project I tried to fix it by following the steps in the error message, but it didn't work. Then I ...- Published on
使用 JavaScript 检查文件是否为 JFIF 格式的方法,通过读取文件头部的 JFIF 签名来验证图像格式