[11] Helpful Functions in Javascript that You Need to Know

1. Generate Random Colors

2. Array Reordering

3. Copy To Clipboard

4. Detect Dark Theme

5. 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.

6. Scroll To Bottom

7. Testing Equipment

8. Hidden Element

9. Get Parameters from the URL

10. Deep Copy Object

structuredClone(obj)

11. Wait Function

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Siddharth Rastogi

Siddharth Rastogi

41 Followers

I am a full stack developer, I have an expertise in Web Development. I write tech stuff and share my knowledge with others with the help of articles.