
Array.prototype.inArray = function(value) {
for (var i = 0; i < this.length; i++) {
if (this[i] === value) {
return true;
}
}
return false;
};
Array.prototype.max = function() {
for (var i = 1, max = this[0]; i < this.length; i++) {
if (max < this[i]) {
max = this[i];
}
return max;
};
Array.prototype.min = function() {
for (var i = 1, min = this[0]; i < this.length; i++) {
if (min > this[i]) {
min = this[i];
}
return min;
};
Array.prototype.indexOf = function(p_var)
{
for (var i = 0; i < this.length; i++)
{
if (this[i] == p_var)
{
return (i);
}
}
return ( - 1);
}
Array.prototype.exists = function(p_var) {
return (this.indexOf(p_var) != -1);
}
Array.prototype.queue = function(p_var) {
this.push(p_var)
}
Array.prototype.dequeue = function() {
return (this.shift());
}
Array.prototype.removeAt = function(p_iIndex) {
return this.splice(p_iIndex, 1);
}
Array.prototype.remove = function(o)
{
var i = this.indexOf(o);
if (i > -1)
{
this.splice(i, 1);
}
return (i > -1);
}
Array.prototype.clear = function()
{
var iLength = this.length;
for (var i = 0; i < iLength; i++)
{
this.shift();
}
}
Array.prototype.addArray = function(p_a)
{
if (p_a)
{
for (var i = 0; i < p_a.length; i++)
{
this.push(p_a[i]);
}
}
}
Array.prototype.Unique = function()
{
var a = {};
for (var i = 0; i < this.length; i++)
{
if (typeof a[this[i]] == "undefined")
a[this[i]] = 1;
}
this.length = 0;
for (var i in a)
this[this.length] = i;
return this;
};
Array.prototype.indexOf = function(obj, fromIndex)
{
if (fromIndex == null)
{
fromIndex = 0;
}
else if (fromIndex < 0)
{
fromIndex = Math.max(0, this.length + fromIndex);
}
for (var i = fromIndex; i < this.length; i++)
{
if (this[i] === obj)
{
return i;
}
}
return - 1;
};
Array.prototype.lastIndexOf = function(obj, fromIndex)
{
if (fromIndex == null)
{
fromIndex = this.length - 1;
}
else if (fromIndex < 0)
{
fromIndex = Math.max(0, this.length + fromIndex);
}
for (var i = fromIndex; i >= 0; i--)
{
if (this[i] === obj)
{
return i;
}
}
return - 1;
};
Array.prototype.insertAt = function(o, i)
{
this.splice(i, 0, o);
};
Array.prototype.insertBefore = function(o, o2)
{
var i = this.indexOf(o2);
if (i == -1)
{
this.push(o);
}
else
{
this.splice(i, 0, o);
}
};
Array.prototype.remove = function(o)
{
var i = this.indexOf(o);
if (i != -1)
{
this.splice(i, 1);
}
};
Array.prototype.mm = function()
{
var a = {},
m = 0,
n = "";
for (var i = 0; i < this.length; i++){
a[this[i]] ? ++a[this[i]] : a[this[i]] = 1;
for (i in a) {
m = Math.max(m, a[i]);
if (m == a[i]) n = i;
}
return {
"variable": n,
"times": m
};
}
for (var i = 0; i < this.length; i++) {
if (this[i] === value) {
return true;
}
}
return false;
};
Array.prototype.max = function() {
for (var i = 1, max = this[0]; i < this.length; i++) {
if (max < this[i]) {
max = this[i];
}
return max;
};
Array.prototype.min = function() {
for (var i = 1, min = this[0]; i < this.length; i++) {
if (min > this[i]) {
min = this[i];
}
return min;
};
Array.prototype.indexOf = function(p_var)
{
for (var i = 0; i < this.length; i++)
{
if (this[i] == p_var)
{
return (i);
}
}
return ( - 1);
}
Array.prototype.exists = function(p_var) {
return (this.indexOf(p_var) != -1);
}
Array.prototype.queue = function(p_var) {
this.push(p_var)
}
Array.prototype.dequeue = function() {
return (this.shift());
}
Array.prototype.removeAt = function(p_iIndex) {
return this.splice(p_iIndex, 1);
}
Array.prototype.remove = function(o)
{
var i = this.indexOf(o);
if (i > -1)
{
this.splice(i, 1);
}
return (i > -1);
}
Array.prototype.clear = function()
{
var iLength = this.length;
for (var i = 0; i < iLength; i++)
{
this.shift();
}
}
Array.prototype.addArray = function(p_a)
{
if (p_a)
{
for (var i = 0; i < p_a.length; i++)
{
this.push(p_a[i]);
}
}
}
Array.prototype.Unique = function()
{
var a = {};
for (var i = 0; i < this.length; i++)
{
if (typeof a[this[i]] == "undefined")
a[this[i]] = 1;
}
this.length = 0;
for (var i in a)
this[this.length] = i;
return this;
};
Array.prototype.indexOf = function(obj, fromIndex)
{
if (fromIndex == null)
{
fromIndex = 0;
}
else if (fromIndex < 0)
{
fromIndex = Math.max(0, this.length + fromIndex);
}
for (var i = fromIndex; i < this.length; i++)
{
if (this[i] === obj)
{
return i;
}
}
return - 1;
};
Array.prototype.lastIndexOf = function(obj, fromIndex)
{
if (fromIndex == null)
{
fromIndex = this.length - 1;
}
else if (fromIndex < 0)
{
fromIndex = Math.max(0, this.length + fromIndex);
}
for (var i = fromIndex; i >= 0; i--)
{
if (this[i] === obj)
{
return i;
}
}
return - 1;
};
Array.prototype.insertAt = function(o, i)
{
this.splice(i, 0, o);
};
Array.prototype.insertBefore = function(o, o2)
{
var i = this.indexOf(o2);
if (i == -1)
{
this.push(o);
}
else
{
this.splice(i, 0, o);
}
};
Array.prototype.remove = function(o)
{
var i = this.indexOf(o);
if (i != -1)
{
this.splice(i, 1);
}
};
Array.prototype.mm = function()
{
var a = {},
m = 0,
n = "";
for (var i = 0; i < this.length; i++){
a[this[i]] ? ++a[this[i]] : a[this[i]] = 1;
for (i in a) {
m = Math.max(m, a[i]);
if (m == a[i]) n = i;
}
return {
"variable": n,
"times": m
};
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)