Array Practice Set In Javascript

let prompt = require("prompt-sync")();

let alert = require("prompt-sync")({ sigint: true });



//Q1


let num = [71, 52, 63, 44, 75, 84, 25, 28, 35]

let a; 


//One Number addition In Array


let a = prompt("Enter a number")

a = Number.parseInt(a)

num.push(a)

console.log(num)


//Q2

 let b = [71, 52, 63, 44, 75, 84, 25, 28, 35]

do {

  a = prompt("Enter a number")

  a = Number.parseInt(a)

  num.push(a)

  


} while (a != 0)

console.log(num)


//Q3


 let num = [70, 52, 63, 40, 75, 84, 20, 28, 30]

let mew = num.filter((a) => {

  return a % 10 == 0

})

console.log(mew) 


//Q4



let num = [70, 52, 63, 40, 75, 84, 20, 28, 30]

let mew = num.map((a) => {

  return a * a

})

console.log(mew) 

Comments

Popular posts from this blog

Launching Page(Javascript)

AMAZON HOME PAGE CLONE PROJECT

Array in function Javascript