编辑函数内的全局数组 [英] edit global array inside function
本文介绍了编辑函数内的全局数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我有这个数组...我想在函数内移动它的前三个值....移位功能不起作用..谢谢你
hello i have this array...and i want shift the first three values of it inside the function ....shift function not work..thank you
var stackHistory=new Array();
function backOff() {
if (stackHistory.length != 0) {
if ($("#Result div").attr("value") != stackHistory[1]) {
$('#Result').append('' + stackHistory[0] + '');
}
dimensions(stackHistory[2]);
stackHistory.shift();
stackHistory.shift();
stackHistory.shift();
cloneItem(); //clone all item in filter
}
else {
var msg = $("#histroyError").val()
$("#error_msg").html('').append(""+msg+"");
errorMsg();
}
}
推荐答案
( #Result div)。attr( value)!= stackHistory [ 1 ]){
("#Result div").attr("value") != stackHistory[1]) {
(' #Result')。append(' ' + stackHistory [ 0 ] + ' '跨度>);
}
维度(stackHistory [ 2 ]);
stackHistory.shift();
stackHistory.shift();
stackHistory.shift();
cloneItem(); // 克隆过滤器中的所有项目
}
else {
var msg =
('#Result').append('' + stackHistory[0] + ''); } dimensions(stackHistory[2]); stackHistory.shift(); stackHistory.shift(); stackHistory.shift(); cloneItem(); //clone all item in filter } else { var msg =
( #histroyError)。val()
这篇关于编辑函数内的全局数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文