假设我有一个Javascript数组,如下所示:
["Element 1","Element 2","Element 3",...]; // with close to a hundred elements.
Run Code Online (Sandbox Code Playgroud)
什么方法适合将数组块(拆分)到许多较小的数组中,比如最多10个元素?
Object.prototype.getB = function() {
// how to get the current value a
return a.b;
};
const a = {b: 'c'};
a.getB();
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我想为所有对象值创建一个函数。我需要获取这个函数中的对象值然后做一些事情。