Skip to content

Commit 179c956

Browse files
committed
first commit
0 parents  commit 179c956

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

day.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// ! Day 1 of learning DSA in Javascript
2+
3+
// * create an array with 5 students names, and after that create a function which takes 2 parameters (allStudents, & studentName ) iterate over all students and find that specific studentName
4+
5+
// Todo: The Array data Structure we use
6+
const students = ["Bhavishya", "Ankit", "Anurag", "Aman", "Somil"];
7+
8+
// Todo: This the Algorithm to solve the Problem
9+
function findName(students, studentName) {
10+
for (let i = 0; i < students.length; i++) {
11+
if (studentName.toLowerCase() === students[i].toLowerCase()) {
12+
return `Student Name Matched ${studentName}`;
13+
}
14+
return `Student not Found`;
15+
}
16+
}
17+
18+
console.log(findName(students, "shon"));

0 commit comments

Comments
 (0)