我想通过将方法从类解析为函数来向数组添加值。
例
课程:
class Foo {
constructor() {
this.arr = [];
}
add(value) {
this.arr.push(value);
用法:
let foo = new Foo();
a(foo.add, "a String");
function a(func, value) {
func(value);
一只名叫tom的猫
繁星淼淼
千万里不及你
相关分类