Agent skill
basis
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/basis
SKILL.md
JavaScript小技巧
来源:https://annatarhe.github.io/2016/04/19/hack-js-code.html
类型转换
1. 转为boolean
!!'foo' // true
!!0 //false
2. 转为number
+'45'
+new Date //转为数字
**3. ~~
~是一个按位取非的操作,返回数值的反码,是二进制操作,JavaScript中的number都是double类型的,在位操作的时候会转化为int,两次就还是原来的数
~~3.1415 // 3 等同于parseInt()
~~5.678 //5
IIFE
创建一个函数作用域,防止全局污染,
(function (arg) {
//作用域
});
Closure
闭包:有权访问外部函数作用域的函数,作用是封装,保存变量的状态
var counter = function() {
counter = 0 ;
return function() {
return count++;
}
}
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?