Given an array as input,find the largest number in the array.Using Javascript
let arr=[5,18,26,30,40,6]; function largest(arr) { let i; let max = arr[0]; for (i = 1; i < arr.length; i++) {… Read More
let arr=[5,18,26,30,40,6]; function largest(arr) { let i; let max = arr[0]; for (i = 1; i < arr.length; i++) {… Read More
const number=[3,4,5,12]; let sum=0; let sum1=0; for(let i=0;i<number.length;i++) { if(number[i]%2==0) { sum=sum+number[i]; } else if(number[i]%2==1) { sum1=sum1+number[i]; } } console.log('Even… Read More
const number=[3,4,5,12]; let sum=0; let count=0; for(let i=0;i<number.length;i++) { if(number[i]%3==0) { sum=sum+number[i]; count++; } } console.log('3Sum='+sum+',3Count='+count); Read More
An array is a data structure, which can store a fixed-size collection of elements of the same data type. An… Read More
const techs=['Python','Javascript','C','Java']; console.log(techs); for(let i=0;i<techs.length;i++) { if(techs[i]=='Javascript') { techs.splice(i+1,0,'Angular','React','Node'); break; } } console.log(techs); Read More
const strings=['Hi','Hello','X','Y']; for(let i=0;i<strings.length;i++) { if(strings[i]=='Hello') { strings.splice(i,1); break; } } console.log(strings); Read More
This website uses cookies.