css
css
<!DOCTYPE html>
<html>
<head>
<title>Multiple of 3 or 7</title>
</head>
<body>
<script>
function checkMultiple(num) {
if (num % 3 === 0 && num % 7 === 0) {
return num + " is a multiple of both 3 and 7.";
} else if (num % 3 === 0) {
return num + " is a multiple of 3.";
} else if (num % 7 === 0) {
return num + " is a multiple of 7.";
} else {
return num + " is not a multiple of 3 or 7.";
}
}
<!DOCTYPE html>
<html>
<head>
<title>String Manipulation</title>
</head>
<body>
<script>
// Given string
let givenString = "I like JavaScript programming";
// Display results
document.write('<p>Modified String: ' + modifiedString + '</p>');
document.write('<p>Part 1: ' + part1 + '</p>');
document.write('<p>Part 2: ' + part2 + '</p>');
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Count Vowels</title>
</head>
<body>
<script>
function countVowels(str) {
// Define vowels
let count = 0;
// Count vowels
if (vowels.includes(char)) {
count++;
return count;
// Given string
// Count vowels
// Display result
</script>
</body>
</html>
5. WAP to find and display the duplicate values along with the count in an integer array.
<!DOCTYPE html>
<html>
<head>
<title>Find Duplicates</title>
</head>
<body>
<script>
function findDuplicates(arr) {
const counts = {};
const duplicates = {};
// Find duplicates
for (const num in counts) {
if (counts[num] > 1) {
duplicates[num] = counts[num];
}
}
return duplicates;
}
// Given array
const givenArray = [1, 2, 3, 2, 4, 5, 1, 6, 1];
// Find duplicates
const duplicateCounts = findDuplicates(givenArray);
// Display result
document.write('<p>Given Array: ' + givenArray + '</p>');
document.write('<p>Duplicates and Counts:</p>');
for (const [num, count] of Object.entries(duplicateCounts)) {
document.write('<p>Number ' + num + ' appears ' + count + ' times</p>');
}
</script>
</body>
</html>