-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathscript.js
40 lines (25 loc) · 976 Bytes
/
script.js
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
var months = ["January","March","February","March"];
// function removeLastItem(){
// months.push("April");
// document.getElementById("result").innerHTML =months;
// }
var numberPart1 = [1,2,3,4,5];
var numberPart2 = [6,7,8,9,10];
var numbers = numberPart1.concat(numberPart2);
for(var counter = 0; counter<months.length; counter++){
document.getElementById("result").innerHTML += months[counter] + "<br>";
}
function addItem(){
var inputValue = document.getElementById("text").value;
months.unshift(inputValue);
document.getElementById("result").innerHTML =months;
}
// length
// indexOf()
// lastIndexOf()
// pop() لحذف اخر قيمة من ارراي
// push() يقوم باضافة قيمة جديدة لنهاية ارراي
// unshift() يقوم بإضافة قيمة جديدة لبداية ارراي
// sort()
// includes() هل يحتوي القيمة الذي نحددها
// concat() لدمج ارراي