Joon's Web Tech Lab 4
-
Question 1: Create a JS function that calculates the
factorial of a given number.
-
Question 2: Take input from the user in loop 5 times and
find the greatest number. In UI, it should display all the
user’s input along with the result.
-
Question 3: Build a function that generates and returns the
Fibonacci sequence up to a specified number of terms.
-
Question 4: Implement a function to remove all duplicate
elements from an array.
-
Question 5: Prompt the user to get the name, age and
occupation. Create the JS object for the inputs and use the
for loop to display the key and values of the object.
-
Question 6: Develop a straightforward quiz game that
utilizes objects to store questions, choices, and correct
answers. Prepare a set of 5 questions that will be presented
to the user individually. Keep track of the total number of
correct and incorrect answers. When the quiz is completed,
users should be able to see and click the button to view the
result.
-
Question 7: Write a simple JavaScript program that responds
to mouseover and mouseout events to change the background
color of an element. It should generate the random color so
that on every mouseout and mouseover it shows a different
color.
-
Question 8: Create a simple JavaScript game using keyboard
events to move an object on the screen. Use the arrow keys
to move the object in respective direction.
-
Question 9: Build a "Show More" button that reveals
additional content when clicked. Initially, just show 50
characters but make sure that it should not end with
incomplete words.
-
Question 10: Create an object with various properties.
Write a function that takes the object and an array of
property renaming rules (e.g., [{ from: "oldName", to:
"newName" }]). Use a for...in loop to rename the properties
according to the rules.
-
Question 11: Write a regex pattern to validate email
addresses. Extract the valid emails from the paragraph and
show the emails in HTML list items.
-
Question 12: Write a regex pattern to extract URLs from a
block of text. Make sure it can handle different types of
URLs (HTTP, HTTPS). Use the mark HTML element to highlight
the valid URLs.
-
Question 13: Develop a regex pattern that extracts dates in
various formats (e.g., MM/DD/YYYY, YYYY-MM-DD) from a
text.