-
Notifications
You must be signed in to change notification settings - Fork 0
/
practice.js
75 lines (48 loc) · 1.12 KB
/
practice.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// const prompt = require('prompt-sync')();
// let input1=prompt("enter the number:")
// if (input1 %5==0){
// console.log("mutiple of 5")
// }
// else{
// console.log("not a mutiple off 5")
// }
//practise
let items=[120,300,340,500,1000,10]
console.log("Before discount",items)
let i=0;
for(let val of items){
let offer = items[i]-val*(10/100);
items[i]=offer;
i++;
}
console.log("After discount",items)
let vege = ["potato","tomato","cabbage","califlower",34,94,56,78];
vege.push("ladyfinger","brinjal")
console.log(vege)
let deleteditem=vege.pop()
console.log(vege)
console.log(deleteditem)
console.log(vege.toString())
const sum=(a,b)=>{
return a+b;
}
console.log(sum(5,5))
let total =0
function func(string){
for(let val of string){
if (val=="0" || val== "a" || val=="e" || val=="i" || val=="u"){
total+=1
}
}
console.log("total vowel : " ,total)
}
func("aaaaaaaa")
// arr=[1,2,3,4,5]
// arr.forEach(element,index,arr => {
// console.log(element,index,arr) ;
// });
arr2=[2,4,6,8,10]
arr2.forEach(element => {
console.log(element**2)
});
//map