Het Awd
Het Awd
Practical 1
// stringDemo.js
Output:
Advanced Web Development 202403103520032
Practical 2
// arrayDemo.js
exampleArray);
Output:
Advanced Web Development 202403103520032
Advanced Web Development 202403103520032
Practical 3
// dateDemo.js
+ currentDate);
Method: getMonth()
Output:
Advanced Web Development 202403103520032
Practical 4
// shoppingCart.js
milk: 1.50},
apparels: {
items: { shirt:
20.00, jeans:40.00,
jacket: 60.00 },
accessories: { items:
{ watch: 100.00,
sunglasses: 50.00 },
gadgets: {
items: { phone:
500.00, tablet:
300.00 },
gadgets: ['phone'] };
cart[category].forEach(item => { if
= categories[category].discount; const
+= discountedPrice; }});}
} return
total; }
+ totalBill.toFixed(2));
Output:
Advanced Web Development 202403103520032
Practical 5
Aim: Create a regular expression to find pattern from the given text as
follow:
1) All the words starting with 'A'.
2) All the words starting with consonants.
// regexPatterns.js
const sampleText = "Apples are amazing. Bananas are better than apples. Aardvark is an
animal.";
wordsStartingWithA = sampleText.match(/\bA\w*/g);
const wordsStartingWithConsonants =
sampleText.match(/\b[BCDFGHJKLMNPQRSTVWXYZ]\w*/g);
console.log("Words starting with consonants:", wordsStartingWithConsonants);
Output:
Advanced Web Development 202403103520084
Practical 6
Aim: Take input from user through prompt box and store it in an array.
Print the Uibonacci series till the indexed number in the array.
// fibonacciSeries.js
readline.createInterface({ input:
});
array of numbers
});
Output:
Advanced Web Development 202403103520084
Practical 7
Aim:Take input from user through prompt box and store it in an array.
Calculate the Factorial of each number present in the array using
iterative method of array and generate the resultant array of factorial
Values.
// factorialCalculator.js
result *= i;
return result;
0 || n === 1) { return 1;
readline.createInterface({ input:
});
interface
});
Output:
Advanced Web Development 202403103520084
Practical 8
// functionDemonstration.js
greet(greeting) { console.log(`${greeting},
this.value * factor;
20
// Example of closure
function makeCounter() {
Advanced Web Development 202403103520132
function() {
count++; return
count;
};
showArguments() {
console.log("Arguments:", arguments);
Output:
Advanced Web Development 202403103520084
Practical 9
// advancedDemonstration.js
count++;
return count;
};
int32View[1] = 84;
Output:
Advanced Web Development 202403103520084
Practical 10
// b) Deleting the name property and changing the sclass property value
},
});
// Output: 12
Output: