From 14f17cee4d4ed81533e429b7a59910982cb7ba96 Mon Sep 17 00:00:00 2001 From: Nishan Ghimire Date: Tue, 31 Mar 2026 21:52:14 +0545 Subject: [PATCH 1/3] for loop --- Students/Nishan/loop.js | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Students/Nishan/loop.js diff --git a/Students/Nishan/loop.js b/Students/Nishan/loop.js new file mode 100644 index 0000000..0155d1c --- /dev/null +++ b/Students/Nishan/loop.js @@ -0,0 +1,52 @@ +//print 9 to 0 +for(let i=9;i>=0;i--){ + console.log(i); +} + +// const arr =["superman","batman","wonderwomen","flash","greenlanton"] +// reverse the array +const arr =["superman","batman","wonderwomen","flash","greenlanton"] +const reversedArr = []; +for(let i=arr.length-1;i>=0;i--){ + reversedArr.push(arr[i]); +} +console.log(reversedArr); + +// only run true login using also continue +const letslearnUsersArray=[{ + name:"saugat Bagale", + age:23, + isLogin:true +},{ + name:"Nishant", + age:24, + isLogin:false +}, +{ + name:"Aakriti", + age:22, + isLogin:true +}, +{ + name:"subin", + age:19, + isLogin:false +}, +{ + name:"kamala", + age:19, + isLogin:true +}, +{ + name:"suman", + age:19, + isLogin:false +} +] +for(let i=0;i Date: Wed, 1 Apr 2026 20:13:13 +0545 Subject: [PATCH 2/3] task 3 --- Students/Nishan/task3.js | 81 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Students/Nishan/task3.js diff --git a/Students/Nishan/task3.js b/Students/Nishan/task3.js new file mode 100644 index 0000000..b84d3c6 --- /dev/null +++ b/Students/Nishan/task3.js @@ -0,0 +1,81 @@ +/* Create a system that processes student data, calculates grades, filters results, and generates reports. It should handle real-world logic like grade calculations, filtering by criteria, and data transformations. + +What to Build: +An array of student objects, where each student has: name, marks (array of subject scores), attendance percentage +Functions that: +Calculate average marks and assign grades (A/B/C/D based on ranges) +Filter students by criteria (e.g., "show only students with > 75 average") +Find top performer and lowest scorer +Check eligibility (average > 40 AND attendance > 75%) +Loops to iterate through data and transform it +Conditionals to apply grading rules (use switch for grade assignment or if/else for eligibility) +Generate a summary report showing: total students, pass count, fail count, average class score +How to Approach It: +Start with data structure — Create realistic student objects with nested arrays (marks per subject) +Build utility functions — Each function should do ONE thing (calculate average, assign grade, filter students) +Use loops strategically — .map() mindset (though not required): transform data from one form to another +Apply game logic — Use conditionals creatively (e.g., bonus points if attendance > 90%) +Combine everything — Chain functions and loops to build the final report +Challenge Twist (Optional): +Add a pass/fail rule: If marks < 40, fail regardless of attendance +Add a merit scholarship checker: Show students eligible for scholarship (average > 80 AND attendance 100) +Export data to a formatted string report using template literals +This project forces them to design with objects, organize logic with functions, and process data with loops — all core pillars. + */ +// Sample student data +const students = [ + { name: "Ram", marks: [85, 90, 78], attendance: 92 }, + { name: "Shyam", marks: [70, 75, 80], attendance: 85 }, + { name: "Hari", marks: [60, 65, 58], attendance: 80 }, + { name: "Gita", marks: [30, 35, 28], attendance: 70 }, + { name: "Sita", marks: [95, 98, 92], attendance: 100 } +]; + +// Function to calculate average marks and assign grades +function calculateGrade(student) { + const average = student.marks.reduce((sum, mark) => sum + mark, 0) / student.marks.length; + let grade; + if (average >= 90) { + grade = 'A'; + } else if (average >= 80) { + grade = 'B'; + } + else if (average >= 70) { + grade = 'C'; + } else if (average >= 40) { + grade = 'D'; + } + else { + grade = 'F'; + } + return { ...student, average, grade }; +} + +// Process students to calculate grades +const processedStudents = students.map(calculateGrade); + +// Filter students with average > 75 +const topStudents = processedStudents.filter(student => student.average > 75); +console.log("Top Students:", topStudents); + +// Find top performer and lowest scorer +const topPerformer = processedStudents.reduce((top, student) => student.average > top.average ? student : top, processedStudents[0]); +const lowestScorer = processedStudents.reduce((low, student) => student.average < low.average ? student : low, processedStudents[0]); +console.log("Top Performer:", topPerformer); +console.log("Lowest Scorer:", lowestScorer); + +// Check eligibility +const eligibleStudents = processedStudents.filter(student => student.average > 40 && student.attendance > 75); +console.log("Eligible Students:", eligibleStudents); + +// Generate summary report +const totalStudents = processedStudents.length; +const passCount = processedStudents.filter(student => student.grade !== 'F').length; +const failCount = totalStudents - passCount; +const averageClassScore = processedStudents.reduce((sum, student) => sum + student.average, 0) / totalStudents; +console.log("Summary Report:"); +console.log("- Total Students:", totalStudents); +console.log("- Pass Count:", passCount); +console.log("- Fail Count:", failCount); +console.log("- Average Class Score:", averageClassScore.toFixed(2)); + From a7688d1013877ff68b0d25976a9b9f0cc6947910 Mon Sep 17 00:00:00 2001 From: Nishan Ghimire Date: Thu, 9 Apr 2026 20:14:55 +0545 Subject: [PATCH 3/3] task 4 and others --- Students/Nishan/DOM.html | 33 +++++++++ Students/Nishan/dom2.html | 22 ++++++ Students/Nishan/for each.js | 11 +++ Students/Nishan/forin & forof.js | 42 +++++++++++ Students/Nishan/html+js.html | 35 ++++++++++ Students/Nishan/task 4.html | 0 Students/Nishan/task4.html | 112 ++++++++++++++++++++++++++++++ 7 files changed, 255 insertions(+) create mode 100644 Students/Nishan/DOM.html create mode 100644 Students/Nishan/dom2.html create mode 100644 Students/Nishan/for each.js create mode 100644 Students/Nishan/forin & forof.js create mode 100644 Students/Nishan/html+js.html create mode 100644 Students/Nishan/task 4.html create mode 100644 Students/Nishan/task4.html diff --git a/Students/Nishan/DOM.html b/Students/Nishan/DOM.html new file mode 100644 index 0000000..48e0823 --- /dev/null +++ b/Students/Nishan/DOM.html @@ -0,0 +1,33 @@ + + + + + + Document + + + + + + + \ No newline at end of file diff --git a/Students/Nishan/dom2.html b/Students/Nishan/dom2.html new file mode 100644 index 0000000..39ec71b --- /dev/null +++ b/Students/Nishan/dom2.html @@ -0,0 +1,22 @@ + + + + + + Document + + + + + + \ No newline at end of file diff --git a/Students/Nishan/for each.js b/Students/Nishan/for each.js new file mode 100644 index 0000000..d23b00b --- /dev/null +++ b/Students/Nishan/for each.js @@ -0,0 +1,11 @@ +//foreach loop is used to iterate over the array and perform a function on each element of the array +const MarbalHeros=["Iron Man","Captain America","Thor","Hulk","Black Widow","Hawkeye"]; +MarbalHeros.forEach(function(hero){ + console.log(hero); +}) + +//foreach loop is used to iterate over the array and perform a function on each element of the array +const numbers=[1,2,3,4,5]; +numbers.forEach(function(number){ + console.log(number*2); +}) \ No newline at end of file diff --git a/Students/Nishan/forin & forof.js b/Students/Nishan/forin & forof.js new file mode 100644 index 0000000..2c30295 --- /dev/null +++ b/Students/Nishan/forin & forof.js @@ -0,0 +1,42 @@ +// forin give only name of the key +const letslearnUsersArray=[{ + name:"saugat Bagale", + age:23, + isLogin:true +},{ + name:"Nishant", + age:24, + isLogin:false +}, +{ + name:"Aakriti", + age:22, + isLogin:true +}, +{ + name:"subin", + age:19, + isLogin:false +}, +{ + name:"kamala", + age:19, + isLogin:true +}, +{ + name:"suman", + age:19, + isLogin:false +}, + +] +//forin give only name of the key +for(let key in letslearnUsersArray){ + console.log(letslearnUsersArray[key].name) +} +//for of give only name +for(let key of letslearnUsersArray){ + console.log(key.name) +} + + diff --git a/Students/Nishan/html+js.html b/Students/Nishan/html+js.html new file mode 100644 index 0000000..14806ae --- /dev/null +++ b/Students/Nishan/html+js.html @@ -0,0 +1,35 @@ + + + + + + Document + + + + + + + + \ No newline at end of file diff --git a/Students/Nishan/task 4.html b/Students/Nishan/task 4.html new file mode 100644 index 0000000..e69de29 diff --git a/Students/Nishan/task4.html b/Students/Nishan/task4.html new file mode 100644 index 0000000..d224d3a --- /dev/null +++ b/Students/Nishan/task4.html @@ -0,0 +1,112 @@ + + + + + + + Document + + + + +

Click the button to see a motivational quote!

+ + + \ No newline at end of file