【文件属性】:
文件名称:toggle-item-in-array:从数组中添加或删除值的函数
文件大小:2KB
文件格式:ZIP
更新时间:2021-05-16 12:26:21
JavaScript
数组中的切换项
一个JavaScript函数,用于使用可选的验证函数来切换数组中的值
切换功能可从数组中添加或删除值
它接受三个参数:
数组
一个值
验证值的函数(可选参数)
如果数组实际包含该值,则将其从数组中删除;否则将其添加到数组中
用法:
NPM:
download this library:
npm i toggle-item-in-array --save
then import it:
import { toggle } from 'toggle-item-in-array';
then you can use it as a function by "toggle" name
HTML:
include the library in your html page
<script src=
【文件预览】:
toggle-item-in-array-main
----package.json(856B)
----README.md(1KB)
----toggle-item-in-array.js(1KB)