دورة javascript للمبتدئين الدرس السابع
1- كيفاش نخدم بل méthode sort
//array.sort()
numbers.sort();
val = numbers.sort(function(x, y){
return x - y;
});
console.log(numbers);
2- كيفاش نخدم بل méthode reverse
//array.reverse()
const fruit = ['Apple', 'Banana', 'Orange', 'Pear'];
console.log(fruit.reverse());
3- كيفاش نخدم بل méthode concat
//array.concat()
val = numbers.concat(numbers2);
console.log(val);
4- كيفاش نخدم بل méthode find
//array.find()
function greaterThan(num){
return num > 50;
}
val = numbers.find(greaterThan);
console.log(val);
5- كيفاش نخدم بل méthode splice
//array.splice()
console.log(numbers);
numbers.splice(1,2);
console.log(numbers);