You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
1.8 KiB
JavaScript

console.log('hello world');
let countries=[ 'US','PH','CAN','SG','TH','PH','FR','DE'];
let indexOfArray= countries.indexOf('PH');
console.log('Resullt of IndexOf method:');
console.log(indexOfArray);
let slicedArrayA = countries.slice(2);
console.log('Resullt of slice method:');
console.log(slicedArrayA);
let taskArrayA= [ 'dring html','eat javascript'];
let taskArrayB= [ 'dring html','eat javascript'];
let taskArrayC= [ 'dring html','eat javascript'];
let task=taskArrayA.concat(taskArrayB);
console.log('Resullt of concat method:');
console.log(task);
let user= [ 'john','jane','joe','jobert'];
console.log('Resullt of join method:');
console.log(user.join());
console.log(user.join(' -'));
console.log(user.join(' /'));
user.forEach( function(task){
console.log(task)
});
let numbers = [ 1,2,3,4,5];
let numberMap = numbers.map(function(number){
return number * number;
});
console.log('Original Array');
console.log(numbers);
console.log(numberMap);
let checkedAll= numbers.every(function(number){
return(number < 3);
});
console.log('Results of every method');
console.log(checkedAll);
let someAll= numbers.some(function(number){
return(number < 2);
});
console.log('Results of every method');
console.log(someAll);
if(someAll){
console.log('some numbers in the array are greater than 2');
}
let filteredAll= numbers.filter(function(number){
return(number == 0);
});
console.log('Results of filter method');
console.log(filteredAll);
let products= [ 'mouse','keyboard','laptop','monitor'];
let product1=products.includes('mouse');
console.log(product1);
let product2=products.includes('keyboard');
console.log(product2);
let includeAll= products.includes(function(products){
console.log(includeAll)
});
console.log('Results of filter method');
console.log(filteredAll);