Skip to content

Commit ab75dd1

Browse files
functions
1 parent 796a9f5 commit ab75dd1

4 files changed

Lines changed: 106 additions & 35 deletions

File tree

functions.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// function a(x,y){
2+
// return x+y;
3+
// }
4+
5+
// function b(x,y){
6+
// return x-y;
7+
// }
8+
9+
// let d=(x,y) =>{
10+
// return x+y;
11+
// }
12+
13+
// let f = d(4,6);
14+
// console.log(f)
15+
// function c(x,y){
16+
// return x*y;
17+
// }
18+
// let k=a(5,10)
19+
// console.log(k)
20+
21+
22+
23+
// let m = (a) =>{
24+
// let c=0
25+
// for (let char of a){
26+
// if (char ==='a' || char ==='e' || char==='i' || char==='o' || char==='u'){
27+
// c++;
28+
// }
29+
// }
30+
// console.log(c)
31+
// }
32+
// let n="saveetha";
33+
// console.log(m(n))
34+
35+
36+
// function a(abc){
37+
// console.log(abc);
38+
// }
39+
// function b(a){
40+
// return c;
41+
// }
42+
43+
44+
// let a=[89,90,92,91,79,77,97,99,87,78,98];
45+
// let newArray=a.filter((val)=>{
46+
// return val>90 ;
47+
// });
48+
49+
// console.log(newArray);
50+
51+
52+
let n=Number(prompt("Enter the number"));
53+
let a=[];
54+
for (let i=1;i<=n;i++){
55+
a[i+1]=i;
56+
}
57+
console.log(a);
58+
let newArr=a.reduce((val,res)=>{
59+
return val*res;
60+
})
61+
console.log(newArr);

new.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>Document</title>
77
</head>
88
<body>
9-
<script src="arrays.js"></script>
9+
<script src="functions.js"></script>
1010
</body>
1111

1212
</html>

tempCodeRunnerFile.js

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
1-
// let n=[10,20,30,40,50]
2-
// n.toString()
3-
// console.log(n)
4-
5-
6-
// let s=[250, 645, 300, 900, 50];
7-
// let n=Number(prompt("Enter the item offer in % format : "));
8-
// for (let i=0;i<s.length;i++){
9-
// m=s[i]*n/100;
10-
// s[i]=s[i]-m
1+
// function a(x,y){
2+
// return x+y;
113
// }
12-
// console.log(s)
13-
14-
15-
// let saveetha=["SSE","SSp","SMCH"]
16-
// let vit=["Vit-Ap","Vit-che"]
17-
// let colleges=saveetha.concat(vit)
18-
// console.log(colleges)
19-
20-
// let n=[10,20,30,40,50,60]
21-
// n.splice(2,2,22,33)
22-
// console.log(n)
23-
// n.splice(3,0,70)
24-
// n.splice(3,1)
25-
// console.log(n)
264

5+
// function b(x,y){
6+
// return x-y;
7+
// }
278

28-
// let c=["Bloomberg","Microsoft","Uber","Google","IBM","Netflix"]
29-
// c.shift();
30-
// console.log(c)
31-
// c.splice(1,1,"ola")
32-
// console.log(c)
33-
// c.push("Amazon")
34-
// console.log(c)
9+
// let d=(x,y) =>{
10+
// return x+y;
11+
// }
3512

36-
let n=[10,20,30,40,50,60]
37-
n.splice(2)
38-
console.log(n)
13+
// let f = d(4,6);
14+
// console.log(f)
15+
// function c(x,y){
16+
// return x*y;
17+
// }
18+
// let k=a(5,10)
19+
// console.log(k)
20+
21+
22+
23+
function s(a){
24+
let c=0
25+
for (let chat of a){
26+
if (char ==='a' || char ==='e' || char==='i' || char==='o' || char==='u'){
27+
c++;
28+
}
29+
}
30+
console.log(c)
31+
}
32+
let m=a("kondareddy");
33+
console.log(m)

test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
let n={
2+
name: "konda",
3+
age : 21,
4+
place : "Kadapa",
5+
DOB : 19052005,
6+
}
7+
for (let key in n){
8+
if (n.place==="Kadapa"){
9+
console.log("he is True")
10+
found=true;
11+
break;
12+
}else{
13+
console.log("He is not True")
14+
}
15+
}

0 commit comments

Comments
 (0)