Does your website need to generate random colors? The following line of code will do it.
Array Reordering
Reordering the elements of an array is a very important trick, but it is not available in native Arrays.
Copy To Clipboard
Copy to clipboard is a very useful and user-friendly feature.
Scroll To Top
– The easiest way to scroll an element to the top is to use scrollIntoView.– Set the block to start to scroll to the top.– Set behavior to smooth to enable smooth scrolling.
Scroll To Bottom
Like scrolling to the top, scrolling to the bottom simply sets the block to end.
Testing Equipment
Use navigator.userAgent to detect which platform device the website is running on.
Get Parameters from the URL
There is a URL object in JavaScript, which can be very convenient to get the parameters in the URL.
Deep Copy Object
Deep copying of an object is very simple. First, convert the object to a string, and then convert it to an object.
Wait Function
JavaScript provides the setTimeout function, but it does not return a Promise object, so we can’t use async on this function, but we can encapsulate the wait function.
Read more...
I hope you like the story, if want to check the more common functions that would help you in the project.Checkout below article link to get the detailed functions.