Day 1: filter() : filter() will always return new array. It will not modify existing array. isBiggerThanFive is the inline callback() function var number = [0,1,2,3,4,5,6,7,8,9]; console.log(number.filter(isBiggerThanFive)); function isBiggerThanFive(n){ return n>5 } In callback() function we can test the conditions and return to the callback() find(): used to filter an element using Id. when the element was not found find() will return the undefined. number.find(isBiggerThanFive); loop(): var n = [0,1,2,3,4,5,6,7,8,9] var filterArray=[];count = 0; for(var i=0;i<=n.length-1;i++){ let el = a[i]; if(el>5){ filterArray.push(a[i]); }else{ count += 1;} } findIndex(): we can get the element of index by using findIndex() method. number.findIndex(4) includes(): includes() will return true or false; true means value present in the array. number.includes(5); There are two common functionalities that is loadData() and showData() related to web development. loadData() can use window...
Comments
Post a Comment