-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctions.js
More file actions
101 lines (77 loc) · 1.99 KB
/
Copy pathFunctions.js
File metadata and controls
101 lines (77 loc) · 1.99 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// function myfunction(){
// console.log("Welcome");
// console.log("Hello");
// }
// myfunction();
/* Arrow Function*/
// const Arrsum=(a,b)=>{
// console.log(a+b);
// };
// Arrsum(7,3);
// const printHell0=()=>{
// console.log("Hello friends");
// }
/*1.Practice Question*/ // Hello ->vowels->2
// methode 1
// function countVowel(val) {
// let count = 0;
// let vowel = ['A','E','I','O','U','a','e','i','o','u'];
// for (let i of val) {
// for (let j of vowel) {
// if (i === j) {
// count++;
// }
// }
// }
// return count;
// }
// console.log(countVowel("hello"));
//Methode 2
// function countVowel(val){
// let count=0;
// let vowel="AEIOUaeiou";
// for(let i of val){
// if(vowel.includes(i)){
// count++;
// }
// }
// return count;
// }
// console.log(countVowel("Hello"));
/* USING ARROW FUNCTION*/
// const countvowel=(val)=>{
// let count = 0;
// let vowel = ['A','E','I','O','U','a','e','i','o','u'];
// for (let i of val) {
// for (let j of vowel) {
// if (i === j) {
// count++;
// }
// }
// }
// return count;
// }
// console.log(countvowel("hello"));
//FOR EACH LOOP
// let arr=[10,20,30,40,50];
// arr.forEach(function printval(val){
// console.log(val);
// })
// let arr=[1,2,3,4,5,6,7];
// arr.forEach((val)=>{
// console.log(val);
// })
//Practice question square of arr using ForEach LOOP
// let arr=[10,20,30,40,50];
// let result=[];
// arr.forEach((val)=>{
// // result.push(val*val);
// console.log(val*val);
// });
// console.log(result);
//MAP function
// let arr=[1,2,3];
// let newarr=arr.map((val)=>{
// return val*val;
// });
// console.log(newarr);