0% found this document useful (0 votes)
2K views

JS Practice

The document lists 40 tasks related to using APIs and manipulating arrays and objects in JavaScript. It includes tasks like making API requests, creating UI elements, validating forms, manipulating dates and times, detecting mobile vs desktop, sorting and merging arrays, and more.

Uploaded by

nurrahman9365
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

JS Practice

The document lists 40 tasks related to using APIs and manipulating arrays and objects in JavaScript. It includes tasks like making API requests, creating UI elements, validating forms, manipulating dates and times, detecting mobile vs desktop, sorting and merging arrays, and more.

Uploaded by

nurrahman9365
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

From the below listed API do the task mentioned.

API : https://demo1.bookingkoala.co.in/api/v3/appload-new
Task

1. Use request.open and other request methods to consume/execute rest API and
console response.
2. Create frequencies buttons as shown in screenshot https://nimb.ws/YtfmSb
3. Create service category dropdown https://nimb.ws/9MLmbu
4. Show extras as shown in screenshot https://nimb.ws/F1aezk
5. Create a form with email id, name, review(text area) field and submit it with JS,
console all value
6. Add validation for valid email id, field should not be blank, no special character in
fields.
7. Show date/time counter/clock using JS, clock should start from current time showing
date, time in hour:minute:seconds.
8. Add a chat icon on the site at bottom right corner using JS https://nimb.ws/ipyZve
9. Create 4 Buttons in a box with names as follows : Red, yellow, green, blue.
10. Change the background of the clicked button to its specific colour.
11. Change the border of the whole wrapper of buttons to the specific selected button
colour.
12. Add a text below the button wrapper and write this "Red button is selected".
13. Write a javascript program to expand/collapse the accordion content :
https://nimb.ws/S5vqe7 .
14. Write a JavaScript program to remove duplicate items from an array.
15. Write a JavaScript program to sort the items of an array. var arr1 = [ 3, 8, 7, 6, 5, -4,
3, 2, 1 ];
16. Write a JavaScript function to merge two arrays and remove all duplicated elements.
17. Write a JavaScript function to convert a Unix timestamp to time.
18. Write a JavaScript function to get the number of days in a month.
19. Write a JavaScript function to compare dates (i.e. greater than, less than or equal to).
20. Write a JavaScript program to get the current URL & get an object containing the
parameters of the current URL.
21. Write a JavaScript program to detect whether the website is being opened in a
mobile device or a desktop/laptop.
22. Write a JavaScript program to truncate a string up to a specified length.
23. Write a JavaScript program to create a new object from the combination of two or
more objects.
24. Write a JavaScript program to create a tooltip using the title attribute :
https://nimb.ws/FqAX4Z .
25. Write a javascript program to create a three level dropdown : https://nimb.ws/eCzfDl .
26. Write a javascript function to toggle the drawer : https://nimb.ws/uQt5Nx
27. Write a javascript function to toggle modal/popup : https://nimb.ws/pSNQhs
28. Write a javascript function to toggle two level modal/popup : https://nimb.ws/MByX7g
29. Write a javascript function to print a pyramid star pattern. https://nimb.ws/x1lgYv
30. Create a dropdown which contains a login form https://nimb.ws/Dr1Md6 and also
make sure that dropdown won't be clipped if we use that dropdown inside a div which
has an overflow hidden property.Dropdown will appear on click of button.
31. Write a function that creates a new array with given values.
Expected Result: (3, 'a') => ['a', 'a', 'a']
32. Write a function that reverts the input array.
Expected Result: [1, 2, 3] => [3, 2, 1]
33. Write a method that clears array from all unnecessary elements, like false, undefined,
empty strings, zero, null
Expected Result: [0, 1, false, 2, undefined, '', 3, null] => [1, 2, 3]
34. Write a method that returns an object composed of key-value pairs.
Expected Result: [['a', 1], ['b', 2]] => { a: 1, b: 2 }
35. The method should return an array without listed values. Let’s try to find a solution
when input data is only primitive data types.
Expected Result: [1, 2, 3, 1, 2] without 1, 2 => [3]
36. Write a method that returns a duplicate-free array.
Expected Result: Duplicate-free array [1, 2, 3, 1, 2] => [1, 2, 3]
37. Write a function that compares two arrays and returns true if they are identical.
Expected Result: ([1, 2, 3], [1, 2, 3]) => true
38. Write a function that turns a deep array into a plain array.
Expected Result: [1, 2, [3, 4, [5]]] => [1, 2, 3, 4, 5]
39. Write a method that splits an array into parts of determined size.
Expected Result: ([1, 2, 3, 4, 5], 2) => [[1, 2], [3, 4], [5]]
40. Create an array of unique values that are included in all given arrays. Let’s start with
primitive data types.
Expected Result: ([1, 2], [2, 3]) => [2]

You might also like