Arrays
Declaración:
var valuesSel = [];
Introducir valores:
valuesSel.push(""+optP15A.getValue());
Validar si contiene un valor:
valuesSel.indexOf(""+opt.getValue())>-1
Validar si NO contiene un valor:
valuesSel.indexOf(""+opt.getValue())==-1
Remove:
var array = [2, 5, 9];
var index = array.indexOf(5);
if (index > -1) {
// el segundo argumento es el número de elementos que se quieren eliminar
// Note that splice modifies the array in place and returns a new array containing the elements that have been removed
array.splice(index, 1);
}
Foreach:
[1,2,3,4,5].forEach(function(value, i) {
});