π A comprehensive collection of daily practical lessons for Web Services and Server Technologies course.
This repository serves as a practical guide through various web services and server technologies. Each lesson is organized in dedicated folders containing both source code and visual outputs.
- Master array manipulation using push and pop operations
- Implement array traversal using forEach loops
- Develop algorithms for array comparison and analysis
- Find common elements between arrays
- Understand nested array operations
- Learn JSON object manipulation
- Practice array reversal techniques
- Implement array frequency analysis
- Find pairs that sum to a target value
- Analyze element frequency in arrays
//Array operations
//push pop
arr3 = ['a','b','d'];
console.log(arr3);
arr3.push('e');
console.log(arr3);
arr3.pop();
console.log(arr3);//Array
//functio
let name = []; //array initialization
let score = [84, 92, 75, 68, 55, 95, 66, 89, 87, 74]; //array declaration
//accessing array element
console.log(score[0]);let score = [84, 92, 75, 68, 55, 95, 66, 89, 87, 74];
for(let i=0;i< score.length;i++)
{
console.log(score[i]);
}let score = [84, 92, 75, 68, 55, 95, 66, 89, 87, 74];
score.forEach((n)=>{
console.log(n);
})//find max number in the array using foreach loop
let score = [84, 92, 75, 68, 55, 95, 66, 89, 87, 74];
let max = score[0];
score.forEach((n)=>{
if(n>max)
{
max = n;
}
});
console.log("Maximum number in the array is: " + max);// Define the arrays
let a = [4, 5, 6, 3, 7];
let b = [8, 3, 2, 1, 5];
// Array to store common elements
let commonElements = [];
// Use forEach to find common elements
a.forEach(element => {
if(b.includes(element)) {
commonElements.push(element);
}
});
// Display the result
console.log("Common elements between arrays:", commonElements);// Print nested array using forEach loop
let nestedArray = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
nestedArray.forEach((n) => {
n.forEach((m) => {
console.log(m);
});
});//reverse the array using push and pop
// a b c d -> d c b a
let arr = ['a','b','c','d'];
let arr2 = [];
while(arr.length > 0) {
arr2.push(arr.pop());
}
console.log(arr2);// Example array and target
let arr = [1, 2, 3, 4, 5, 6];
let target = 7;
// Function to find pairs that sum up to target using forEach
function findPairs(arr, target) {
let pairs = [];
// Use forEach to iterate through each number
arr.forEach((num1, index) => {
// Only check numbers after the current number to avoid duplicates
arr.slice(index + 1).forEach(num2 => {
// If pair sums to target, add to results
if(num1 + num2 === target) {
pairs.push([num1, num2]);
}
});
});
return pairs;
}const numbers = [4,8,3,4,3,2,1,8,4];
// Create a Map to store frequency
const numberCount = new Map();
// Count frequency of each number
numbers.forEach(number => {
const currentCount = numberCount.get(number) || 0;
numberCount.set(number, currentCount + 1);
});
// Find the most frequent number
let highestCount = 0;
let mostCommonNumber = null;
numberCount.forEach((count, number) => {
if (count > highestCount) {
highestCount = count;
mostCommonNumber = number;
}
});//JSON
//{key:value}
let student = {
name: "John",
age: 20,
marks: 90,
isPassed: true,
address: {
street: "123 Main St",
city: "Anytown"
}
};| Category | File | Description | Output |
|---|---|---|---|
| Basic Array Operations | Arrayoperationspushpop.js |
Basic array push/pop operations | View |
| Basic Array Operations | printarray.js |
Array initialization and access | View |
| Array Traversal | printarrayusingforloop.js |
Array traversal using for loop | View |
| Array Traversal | printarrayusingforeachloop.js |
Array traversal using forEach | View |
| Array Analysis | findmaxnumberinthearrayusingforeachloop.js |
Finding maximum value using forEach | View |
| Array Comparison | findthecommonelementsbetweentwoarrays.js |
Finding common elements between arrays | View |
| Nested Arrays | printthenestedarray.js |
Nested array traversal using forEach | View |
| Array Manipulation | reversethearrayusingpushpop.js |
Array reversal using push/pop | View |
| Array Algorithms | findingpairsinanarraythatsumuptoatargetvalue.js |
Finding pairs that sum to target | View |
| Array Analysis | findthemostfrequentelementinthearray.js |
Finding most frequent element | View |
| JSON Operations | JSON.js |
JSON object manipulation | View |
| Student Data Analysis | homework.js |
Student data filtering and GPA analysis | View |
- All implementations are in pure JavaScript
- Extensive use of ES6+ array methods
- Each example includes comprehensive console output
- Visual outputs are captured for reference
- Consistent code formatting and naming conventions
π Learning Path | π οΈ Practical Examples | π Visual Outputs