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
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script> let nums = new Array(); nums.push(3); nums.push(13); nums.push(25); console.log(nums); let n1 = nums.pop(); console.log("nums : ", nums); console.log("n1 : ", n1);
let num2 = new Array(2,3,"hello", 7); console.log(num2); console.log(num2[2]); let num3 = new Array(2, 3, "hello", 7, new Array(2,3,4)); console.log(num3[4]); console.log(num3[4][1]);
num2.splice(2); console.log(num2); num2.splice(2,1); console.log(num2); num2.splice(2,1, "HUMAN"); num2.splice(2,0, "COMP");
</script> </head> <body> </body> </html>
|