500+ ways to load Javascript in frontend

shrey vijayvargiya
5 min readJul 6, 2024

There are 500 ways to load JS in frontend

Under the Hood

You know iHateReading is all about these types of content, the content that makes reading good and easy.

Sharing the 500 ways to reload the javascript in frontend.

The window object of the browser and class constructor provides 500+ ways to do so.

  1. location = location
  2. location = location.href
  3. location = window.location
  4. location = self.location
  5. location = window.location.href
  6. location = self.location.href
  7. location = location[‘href’]
  8. location = window[‘location’]
  9. location = window[‘location’].href
  10. location = window[‘location’][‘href’]
  11. location = window.location[‘href’]
  12. location = self[‘location’]
  13. location = self[‘location’].href
  14. location = self[‘location’][‘href’]
  15. location = self.location[‘href’]
  16. location.assign(location)
  17. location.replace(location)
  18. window.location.assign(location)

--

--