-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharreglos.html
More file actions
71 lines (45 loc) · 1.32 KB
/
Copy patharreglos.html
File metadata and controls
71 lines (45 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<<!DOCTYPE html>
<html>
<head>
<title>arreglos</title>
</head>
<body>
<script type="text/javascript">
/*
var arreglo = new Array();
arreglo.push(3);
arreglo.push('hola mundo');
arreglo[0]= 'soy raitom';
console.log(arreglo[0]); // leer elementos ddel arreglo en console
*/
// lengt cuenta la lonjitud del arreglo
/* arreglos ............... unidimensional
var arreglo=[1,'hola','mundo'];
//console.log(arreglo.length);
for(i=0;i<arreglo.length;i++)
console.log(arreglo[i]);
*/
/*arreglo bidimencional....................
var arreglo=[[1,2,3],['a','b','c']];
for(i=0;i<arreglo[1].length;i++)
{ console.log(arreglo[1][i]);
alert(arreglo[1][i]);
} */
// converitr elementos de un arreglo en cadena..................
/*var arreglo=[[1,2,3],['a','b','c']];
var cadena= arreglo[1].join('');
console.log(cadena);
*/
//inverso
/* var cadena ='a-bc';
var arreglo=cadena.split('-');
console.log(arreglo[1]);
*/
//split separa dependiendo del caracter o cadena que se ponga
var cadena =prompt('Ingrese su nombre:','');
var arreglo=cadena.split('').reverse().join("");
alert(arreglo);
</script>
//prompt tiene dos parámetros: uno es el mensaje y el otro el valor inicial a mostrar.
</body>
</html>